-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove blob-url from the default config
- Loading branch information
Will Binns-Smith
committed
Nov 6, 2019
1 parent
933113b
commit cc36cee
Showing
6 changed files
with
69 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// @flow strict-local | ||
|
||
import assert from 'assert'; | ||
import path from 'path'; | ||
import {bundle, distDir, outputFS, inputFS} from '@parcel/test-utils'; | ||
|
||
const configPath = path.join(__dirname, '/integration/blob-url/.parcelrc'); | ||
|
||
const config = { | ||
...JSON.parse(inputFS.readFileSync(configPath)), | ||
filePath: configPath | ||
}; | ||
|
||
describe('blob urls', () => { | ||
it('should inline compiled content as a blob url with `blob-url:*` imports', async () => { | ||
await bundle(path.join(__dirname, '/integration/blob-url/index.js'), { | ||
config | ||
}); | ||
|
||
let bundleContent = await outputFS.readFile( | ||
path.join(distDir, 'index.js'), | ||
'utf8' | ||
); | ||
assert( | ||
bundleContent.includes( | ||
'new Worker(URL.createObjectURL(new Blob(["// modules are defined as an array\\n' | ||
) | ||
); | ||
assert( | ||
bundleContent.includes( | ||
'self.postMessage(\\"this should appear in the bundle\\\\n\\")' | ||
) | ||
); | ||
}); | ||
|
||
it('should inline minified content as a blob url with `blob-url:*` imports', async () => { | ||
await bundle(path.join(__dirname, '/integration/blob-url/index.js'), { | ||
config, | ||
minify: true | ||
}); | ||
|
||
let bundleContent = await outputFS.readFile( | ||
path.join(distDir, 'index.js'), | ||
'utf8' | ||
); | ||
assert( | ||
bundleContent.includes( | ||
"new Worker(URL.createObjectURL(new Blob(['!function(" | ||
) | ||
); | ||
assert( | ||
bundleContent.includes( | ||
'self.postMessage("this should appear in the bundle\\\\n")' | ||
) | ||
); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
packages/core/integration-tests/test/integration/blob-url/.parcelrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
{ | ||
"extends": "@parcel/config-default", | ||
"transforms": { | ||
"blob-url:*": ["@parcel/transformer-inline", "..."] | ||
}, | ||
"optimizers": { | ||
"blob-url:*": ["...", "@parcel/optimizer-blob-url"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters