Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Merge compact and non-compact import.meta.url mechanisms * Extract more common code * Add option to configure import.meta.url resolution * Switch to using a plugin hook * Extract more common code * Move functionality into default plugin * Improve SystemJS handling * Refactor import.meta.url handling * Fix, refactor and test asset emission * Extract ModuleLoader * Use sets for colouring hashes * Simplify alias generation * Attach aliases to modules * Transform loading into a process that dynamically accepts new entry points and manual chunks * Pass alias objects through the module loader * Implement basic chunk emission * Allow duplicate entry points again * Rename addEntry -> emitEntryChunk * Simplify alias handling by immediately assigning a chunkAlias to entry points and introducing a manualChunkAlias for colouring to resolve this confusing double use of chunkAlias * * Allow manual chunks to contain nested entry points * Allow manual chunks to contain entry points without name or with the same name * Throw if an emitted chunk is not found * Throw if there is a conflict between manual chunk entries * Allow nesting of manual chunks without requiring a specific order * Manual chunks never conflict with entry points: - if the alias matches, the manual chunk becomes the entry chunk - otherwise a facade is created * Return correct file name if a facade is created for an emitted chunk * Start using central error handlers * Improve plugin driver type, add generic resolveFileUrl hook * Test new resolveFileUrl hook, make meta properties tree-shakeable * Move setAssetSource failure tests to function * Test and extract all errors thrown when emitting assets * Extract and refine error when chunk id cannot be found * Fail if filename is not yet available * Fail when adding a chunk after loading has finished * Do not access process.cwd() unchecked * Move isExternal to module loader * Fix typing of resolveId context hook * Refine worker test * Revert to "wrong" resolveId type as this will probably be fixed in a separate PR * Suppress .js extensions for AMD, fix issue with empty dynamically imported chunks * Use generated chunk naming scheme for emitted chunks and rename context function to `emitChunk` * Allow emitted chunks to be named * Add paint worklet example * Update documentation * Add reference ids to resolveFileUrl and replace type * Do not require `input` to be set if a dynamic entry is emitted * Use facade module id as [name] for dynamic imports * Update documentation * Refine pluginDriver types (ported from add-entry branch) * Make sure resolveId is always passed either string or null * Unify parameter names * Add new this.resolve context function * Get rid of dynamic import alias * Make sure resolveDynamicImport behaves the same as resolveId if an object is returned * Test new warnings and errors * Mark this.resolveId and this.isExternal as deprecated * Extract more errors * Use error message generators instead of error generators * Fix documentation ordering * Mark utility functions deprecated in types * Use relative ids in error messages * Allow manualChunks to be a function * Only add manual chunks in a single location * Add vendor chunk example
- Loading branch information
1 parent
856707c
commit d96a846
Showing
25 changed files
with
186 additions
and
30 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
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
12 changes: 12 additions & 0 deletions
12
test/chunking-form/samples/manual-chunks-function/_config.js
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,12 @@ | ||
module.exports = { | ||
description: 'allows to define manual chunks via a function', | ||
options: { | ||
input: ['main-a'], | ||
manualChunks(id) { | ||
if (id[id.length - 5] === '-') { | ||
console.log(id, id[id.length - 4]); | ||
return `chunk-${id[id.length - 4]}`; | ||
} | ||
} | ||
} | ||
}; |
9 changes: 9 additions & 0 deletions
9
test/chunking-form/samples/manual-chunks-function/_expected/amd/chunk-a.js
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,9 @@ | ||
define(['./generated-chunk-b', './generated-chunk-c'], function (__chunk_1, __chunk_2) { 'use strict'; | ||
|
||
console.log('dep1'); | ||
|
||
console.log('dep-a'); | ||
|
||
console.log('main-a'); | ||
|
||
}); |
7 changes: 7 additions & 0 deletions
7
test/chunking-form/samples/manual-chunks-function/_expected/amd/generated-chunk-b.js
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,7 @@ | ||
define(function () { 'use strict'; | ||
|
||
console.log('dep2'); | ||
|
||
console.log('dep-b'); | ||
|
||
}); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/manual-chunks-function/_expected/amd/generated-chunk-c.js
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,5 @@ | ||
define(['./generated-chunk-b'], function (__chunk_1) { 'use strict'; | ||
|
||
console.log('dep-c'); | ||
|
||
}); |
10 changes: 10 additions & 0 deletions
10
test/chunking-form/samples/manual-chunks-function/_expected/cjs/chunk-a.js
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 @@ | ||
'use strict'; | ||
|
||
require('./generated-chunk-b.js'); | ||
require('./generated-chunk-c.js'); | ||
|
||
console.log('dep1'); | ||
|
||
console.log('dep-a'); | ||
|
||
console.log('main-a'); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/manual-chunks-function/_expected/cjs/generated-chunk-b.js
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,5 @@ | ||
'use strict'; | ||
|
||
console.log('dep2'); | ||
|
||
console.log('dep-b'); |
5 changes: 5 additions & 0 deletions
5
test/chunking-form/samples/manual-chunks-function/_expected/cjs/generated-chunk-c.js
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,5 @@ | ||
'use strict'; | ||
|
||
require('./generated-chunk-b.js'); | ||
|
||
console.log('dep-c'); |
8 changes: 8 additions & 0 deletions
8
test/chunking-form/samples/manual-chunks-function/_expected/es/chunk-a.js
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,8 @@ | ||
import './generated-chunk-b.js'; | ||
import './generated-chunk-c.js'; | ||
|
||
console.log('dep1'); | ||
|
||
console.log('dep-a'); | ||
|
||
console.log('main-a'); |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/manual-chunks-function/_expected/es/generated-chunk-b.js
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,3 @@ | ||
console.log('dep2'); | ||
|
||
console.log('dep-b'); |
3 changes: 3 additions & 0 deletions
3
test/chunking-form/samples/manual-chunks-function/_expected/es/generated-chunk-c.js
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,3 @@ | ||
import './generated-chunk-b.js'; | ||
|
||
console.log('dep-c'); |
15 changes: 15 additions & 0 deletions
15
test/chunking-form/samples/manual-chunks-function/_expected/system/chunk-a.js
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,15 @@ | ||
System.register(['./generated-chunk-b.js', './generated-chunk-c.js'], function (exports, module) { | ||
'use strict'; | ||
return { | ||
setters: [function () {}, function () {}], | ||
execute: function () { | ||
|
||
console.log('dep1'); | ||
|
||
console.log('dep-a'); | ||
|
||
console.log('main-a'); | ||
|
||
} | ||
}; | ||
}); |
12 changes: 12 additions & 0 deletions
12
test/chunking-form/samples/manual-chunks-function/_expected/system/generated-chunk-b.js
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,12 @@ | ||
System.register([], function (exports, module) { | ||
'use strict'; | ||
return { | ||
execute: function () { | ||
|
||
console.log('dep2'); | ||
|
||
console.log('dep-b'); | ||
|
||
} | ||
}; | ||
}); |
11 changes: 11 additions & 0 deletions
11
test/chunking-form/samples/manual-chunks-function/_expected/system/generated-chunk-c.js
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,11 @@ | ||
System.register(['./generated-chunk-b.js'], function (exports, module) { | ||
'use strict'; | ||
return { | ||
setters: [function () {}], | ||
execute: function () { | ||
|
||
console.log('dep-c'); | ||
|
||
} | ||
}; | ||
}); |
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,4 @@ | ||
import './dep-c'; | ||
import './dep1'; | ||
|
||
console.log('dep-a'); |
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,3 @@ | ||
import './dep2'; | ||
|
||
console.log('dep-b'); |
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,3 @@ | ||
import './dep2'; | ||
|
||
console.log('dep-c'); |
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 @@ | ||
console.log('dep1'); |
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 @@ | ||
console.log('dep2'); |
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,4 @@ | ||
import './dep-a'; | ||
import './dep-b'; | ||
|
||
console.log('main-a'); |
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