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/api.js
CHANGED
|
@@ -85181,16 +85181,21 @@
|
|
|
85181
85181
|
if (length <= ++index) return false
|
|
85182
85182
|
arg = args[index];
|
|
85183
85183
|
}
|
|
85184
|
-
|
|
85185
|
-
|
|
85186
|
-
|
|
85184
|
+
if (arg.type === 'FunctionExpression' || arg.type === 'ArrowFunctionExpression') {
|
|
85185
|
+
return { namespace, func, name, deps, factory: arg }
|
|
85186
|
+
}
|
|
85187
|
+
return arg.type === 'ObjectExpression' && { namespace, func, name, deps, output: arg }
|
|
85187
85188
|
}
|
|
85188
85189
|
|
|
85189
85190
|
// require([deps], success, error)
|
|
85190
85191
|
if (func.name === 'require') {
|
|
85191
85192
|
const deps = args[0];
|
|
85192
|
-
|
|
85193
|
-
args[1]
|
|
85193
|
+
if (deps.type === 'ArrayExpression' && length >= 2) {
|
|
85194
|
+
const body = args[1];
|
|
85195
|
+
if (body.type === 'FunctionExpression' || body.type === 'ArrowFunctionExpression') {
|
|
85196
|
+
return { func, deps, body }
|
|
85197
|
+
}
|
|
85198
|
+
}
|
|
85194
85199
|
}
|
|
85195
85200
|
}
|
|
85196
85201
|
|