Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* implement `amd.idFromChunkName` option * update output-options-hook test * update NormalizedOutputOptions type * simiplify removeExtension() * fix `idFromChunkName` type * make `idFromChunkName` required in normalized options * reference actual types in normalizeOutputOptions * switch to using a pattern instead * also removeExtensionFromRelativeAmdId in UMD finaliser * support id in output.amd.id in umd finaliser * move test to chunking-form/samples * remove test from cli section * remove idFromChunkName * revert chunking-form index change * break out to amd.autoId and amd.basePath options * remove unneeded changes * update docs * update test to also put chunks in folder * throw error if amd.id used with muli-file build * more accurate amd options type * update output.amd doc * fix `@ts-expect-error` comments * add tests for invalid options * add test for entryFileNames with output.preserveModules * ignore internal error in coverage * simplify type * fix output options test * fix type tests * improve types again * simply again * make it a warning
- Loading branch information
1 parent
0786839
commit 163252a
Showing
80 changed files
with
735 additions
and
70 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
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,13 @@ | ||
import { NormalizedOutputOptions } from '../../rollup/types'; | ||
import removeJsExtension from './removeJsExtension'; | ||
|
||
export default function getCompleteAmdId( | ||
options: NormalizedOutputOptions['amd'], | ||
chunkId: string | ||
): string { | ||
if (!options.autoId) { | ||
return options.id || ''; | ||
} else { | ||
return `${options.basePath ? options.basePath + '/' : ''}${removeJsExtension(chunkId)}`; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import removeJsExtension from './removeJsExtension'; | ||
|
||
// AMD resolution will only respect the AMD baseUrl if the .js extension is omitted. | ||
// The assumption is that this makes sense for all relative ids: | ||
// https://requirejs.org/docs/api.html#jsfiles | ||
export default function removeExtensionFromRelativeAmdId(id: string) { | ||
if (id[0] === '.' && id.endsWith('.js')) { | ||
return id.slice(0, -3); | ||
} | ||
return id; | ||
return id[0] === '.' ? removeJsExtension(id) : id; | ||
} |
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 @@ | ||
export default function removeJsExtension(name: string) { | ||
return name.endsWith('.js') ? name.slice(0, -3) : name; | ||
} |
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
Oops, something went wrong.