requirejs-esm 2.2.0 → 2.2.1
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 +10 -5
- package/dist/api.js.map +1 -1
- package/dist/plugin.js +10 -5
- package/dist/plugin.js.map +1 -1
- package/package.json +4 -4
- package/src/api.d.ts +3 -0
- package/src/transformer/amd.js +10 -5
package/dist/plugin.js
CHANGED
|
@@ -85276,16 +85276,21 @@
|
|
|
85276
85276
|
if (length <= ++index) return false
|
|
85277
85277
|
arg = args[index];
|
|
85278
85278
|
}
|
|
85279
|
-
|
|
85280
|
-
|
|
85281
|
-
|
|
85279
|
+
if (arg.type === 'FunctionExpression' || arg.type === 'ArrowFunctionExpression') {
|
|
85280
|
+
return { namespace, func, name, deps, factory: arg }
|
|
85281
|
+
}
|
|
85282
|
+
return arg.type === 'ObjectExpression' && { namespace, func, name, deps, output: arg }
|
|
85282
85283
|
}
|
|
85283
85284
|
|
|
85284
85285
|
// require([deps], success, error)
|
|
85285
85286
|
if (func.name === 'require') {
|
|
85286
85287
|
const deps = args[0];
|
|
85287
|
-
|
|
85288
|
-
args[1]
|
|
85288
|
+
if (deps.type === 'ArrayExpression' && length >= 2) {
|
|
85289
|
+
const body = args[1];
|
|
85290
|
+
if (body.type === 'FunctionExpression' || body.type === 'ArrowFunctionExpression') {
|
|
85291
|
+
return { func, deps, body }
|
|
85292
|
+
}
|
|
85293
|
+
}
|
|
85289
85294
|
}
|
|
85290
85295
|
}
|
|
85291
85296
|
|