@marko/compiler 5.28.4 → 5.28.5
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/babel-plugin/index.js +1 -0
- package/dist/index.js +20 -10
- package/package.json +2 -2
|
@@ -53,6 +53,7 @@ const SOURCE_FILES = new WeakMap();var _default =
|
|
|
53
53
|
opts.parserOpts.allowReturnOutsideFunction =
|
|
54
54
|
opts.parserOpts.allowSuperOutsideMethod =
|
|
55
55
|
opts.parserOpts.allowUndeclaredExports =
|
|
56
|
+
opts.parserOpts.allowNewTargetOutsideFunction =
|
|
56
57
|
true;
|
|
57
58
|
curOpts = opts;
|
|
58
59
|
},
|
package/dist/index.js
CHANGED
|
@@ -65,14 +65,14 @@ function loadMarkoConfig(config) {
|
|
|
65
65
|
const markoConfig = { ...globalConfig, ...config };
|
|
66
66
|
|
|
67
67
|
if (markoConfig.stripTypes === undefined) {
|
|
68
|
-
markoConfig.stripTypes =
|
|
69
|
-
markoConfig.output !== "source" && markoConfig.output !== "migrate";
|
|
68
|
+
markoConfig.stripTypes = isTranslatedOutput(markoConfig.output);
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
return markoConfig;
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
function loadBabelConfig(filename, { babelConfig, ...markoConfig }) {
|
|
75
|
+
const isTranslated = isTranslatedOutput(markoConfig.output);
|
|
76
76
|
const requiredPlugins = [
|
|
77
77
|
[_babelPlugin.default, markoConfig],
|
|
78
78
|
[
|
|
@@ -92,23 +92,29 @@ function loadBabelConfig(filename, { babelConfig, ...markoConfig }) {
|
|
|
92
92
|
_path.default.relative(process.cwd(), filename) :
|
|
93
93
|
undefined,
|
|
94
94
|
sourceFileName: filename ? _path.default.basename(filename) : undefined,
|
|
95
|
+
configFile: isTranslated,
|
|
96
|
+
babelrc: isTranslated,
|
|
95
97
|
...babelConfig,
|
|
96
98
|
filename,
|
|
97
99
|
sourceType: "module",
|
|
98
100
|
sourceMaps: markoConfig.sourceMaps,
|
|
99
101
|
code: markoConfig.code,
|
|
100
|
-
ast: markoConfig.ast
|
|
102
|
+
ast: markoConfig.ast,
|
|
103
|
+
plugins:
|
|
104
|
+
babelConfig && babelConfig.plugins ?
|
|
105
|
+
requiredPlugins.concat(babelConfig.plugins) :
|
|
106
|
+
requiredPlugins
|
|
101
107
|
};
|
|
102
108
|
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
baseBabelConfig.plugins = requiredPlugins.concat(
|
|
108
|
-
baseBabelConfig.plugins || []);
|
|
109
|
+
if (isTranslated) {
|
|
110
|
+
if (markoConfig.modules === "cjs") {
|
|
111
|
+
baseBabelConfig.plugins.push([_pluginTransformModulesCommonjs.default, { loose: true }]);
|
|
112
|
+
}
|
|
109
113
|
|
|
114
|
+
return babel.loadPartialConfig(baseBabelConfig).options;
|
|
115
|
+
}
|
|
110
116
|
|
|
111
|
-
return
|
|
117
|
+
return baseBabelConfig;
|
|
112
118
|
}
|
|
113
119
|
|
|
114
120
|
function buildResult(src, filename, errorRecovery, babelResult) {
|
|
@@ -180,4 +186,8 @@ function isDefaultCache(config) {
|
|
|
180
186
|
|
|
181
187
|
function getFs(config) {
|
|
182
188
|
return config.fileSystem || globalConfig.fileSystem;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function isTranslatedOutput(output) {
|
|
192
|
+
return output !== "source" && output !== "migrate";
|
|
183
193
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marko/compiler",
|
|
3
3
|
"description": "Marko template to JS compiler.",
|
|
4
|
-
"version": "5.28.
|
|
4
|
+
"version": "5.28.5",
|
|
5
5
|
"author": "Dylan Piercey <dpiercey@ebay.com>",
|
|
6
6
|
"bugs": "https://github.com/marko-js/marko/issues/new?template=Bug_report.md",
|
|
7
7
|
"dependencies": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"strip-json-comments": "^3.1.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@marko/translator-default": "^5.26.
|
|
33
|
+
"@marko/translator-default": "^5.26.5"
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"dist",
|