requirejs-esm 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +36 -9
- package/dist/api.js.map +1 -1
- package/dist/plugin.js +36 -9
- package/dist/plugin.js.map +1 -1
- package/package.json +1 -1
- package/src/transformer/amd.js +31 -5
- package/src/transformer/index.js +6 -5
package/dist/plugin.js
CHANGED
|
@@ -86428,17 +86428,25 @@
|
|
|
86428
86428
|
|
|
86429
86429
|
// Updates dependency paths to be prefixed by `esm!` or otherwise updated.
|
|
86430
86430
|
function updateAmdDeps(amd, options) {
|
|
86431
|
-
options.onBeforeUpdate?.(
|
|
86431
|
+
let updated = options.onBeforeUpdate?.({
|
|
86432
|
+
...options,
|
|
86433
|
+
amd
|
|
86434
|
+
});
|
|
86432
86435
|
|
|
86433
86436
|
const { deps } = amd;
|
|
86434
|
-
if (!deps)
|
|
86437
|
+
if (!deps) {
|
|
86438
|
+
afterUpdate();
|
|
86439
|
+
return updated
|
|
86440
|
+
}
|
|
86435
86441
|
|
|
86436
86442
|
const { sourceFileName: parentName } = options;
|
|
86437
86443
|
const { elements } = deps;
|
|
86438
|
-
if (!elements.length)
|
|
86444
|
+
if (!elements.length) {
|
|
86445
|
+
afterUpdate();
|
|
86446
|
+
return updated
|
|
86447
|
+
}
|
|
86439
86448
|
|
|
86440
86449
|
const { resolvePath } = options;
|
|
86441
|
-
let updated;
|
|
86442
86450
|
for (const element of elements) {
|
|
86443
86451
|
if (element.type === 'Literal') {
|
|
86444
86452
|
const moduleName = element.value;
|
|
@@ -86450,9 +86458,27 @@
|
|
|
86450
86458
|
}
|
|
86451
86459
|
}
|
|
86452
86460
|
|
|
86453
|
-
|
|
86461
|
+
afterUpdate();
|
|
86454
86462
|
|
|
86455
86463
|
return updated
|
|
86464
|
+
|
|
86465
|
+
function afterUpdate() {
|
|
86466
|
+
const updatedNow = options.onAfterUpdate?.({
|
|
86467
|
+
...options,
|
|
86468
|
+
amd
|
|
86469
|
+
});
|
|
86470
|
+
updated ||= updatedNow;
|
|
86471
|
+
}
|
|
86472
|
+
}
|
|
86473
|
+
|
|
86474
|
+
function callAmdUpdateHooks(amd, options) {
|
|
86475
|
+
options = {
|
|
86476
|
+
...options,
|
|
86477
|
+
amd
|
|
86478
|
+
};
|
|
86479
|
+
const updatedBefore = options.onBeforeUpdate?.(options);
|
|
86480
|
+
const updatedAfter = options.onAfterUpdate?.(options);
|
|
86481
|
+
return updatedBefore || updatedAfter
|
|
86456
86482
|
}
|
|
86457
86483
|
|
|
86458
86484
|
function _generateUid(name, i) {
|
|
@@ -86908,10 +86934,11 @@
|
|
|
86908
86934
|
const result = {};
|
|
86909
86935
|
if (length) {
|
|
86910
86936
|
result.amd = true;
|
|
86911
|
-
|
|
86912
|
-
|
|
86913
|
-
|
|
86914
|
-
|
|
86937
|
+
for (const amd of amds) {
|
|
86938
|
+
const updated = options.resolvePath
|
|
86939
|
+
? updateAmdDeps(amd, options)
|
|
86940
|
+
: callAmdUpdateHooks(amd, options);
|
|
86941
|
+
result.updated ||= updated;
|
|
86915
86942
|
}
|
|
86916
86943
|
} else {
|
|
86917
86944
|
transformEsmToAmd(program, options);
|