requirejs-esm 2.0.0 → 2.0.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/bin/esm2requirejs.js +10 -6
- package/dist/api.js +1 -1
- package/dist/api.js.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/package.json +3 -2
package/bin/esm2requirejs.js
CHANGED
|
@@ -51,18 +51,22 @@ if (!args.length) {
|
|
|
51
51
|
}
|
|
52
52
|
for (const file of files) {
|
|
53
53
|
const text = await readFile(file, 'utf8')
|
|
54
|
-
const code = transform(text, file, {
|
|
54
|
+
const { code, updated } = transform(text, file, {
|
|
55
55
|
/*ecmaVersion,*/
|
|
56
56
|
pluginName,
|
|
57
57
|
sourceMap,
|
|
58
58
|
verbose
|
|
59
59
|
})
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
if (updated) {
|
|
61
|
+
if (outputFile) {
|
|
62
|
+
await writeFile(outputFile, code)
|
|
63
|
+
} else if (rewrite) {
|
|
64
|
+
await writeFile(file, code)
|
|
65
|
+
} else {
|
|
66
|
+
console.log(`// ${file}\n\n${code}`)
|
|
67
|
+
}
|
|
64
68
|
} else {
|
|
65
|
-
console.log(`// ${file}\n\
|
|
69
|
+
console.log(`// ${file}\n\nnot updated`)
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
72
|
} catch (error) {
|
package/dist/api.js
CHANGED
|
@@ -85616,7 +85616,7 @@
|
|
|
85616
85616
|
sourceMap
|
|
85617
85617
|
} = {}) {
|
|
85618
85618
|
// const ast = parse(text, { ecmaVersion, sourceType: 'module', locations: true })
|
|
85619
|
-
let ast = parseModule(text, { loc: true });
|
|
85619
|
+
let ast = parseModule(text, { next: true, loc: true });
|
|
85620
85620
|
|
|
85621
85621
|
const options = { sourceFileName: file, pluginName, resolvePath: resolvePath$1, originalResolvePath: resolvePath };
|
|
85622
85622
|
transformModules(ast, options);
|