@powerlines/plugin-babel 0.12.225 → 0.12.227
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/index.cjs +3 -7
- package/dist/index.mjs +3 -7
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -44,19 +44,14 @@ const plugin = (options = {}) => {
|
|
|
44
44
|
id
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
this.debug(`Babel transforming file: ${id}`);
|
|
48
47
|
const plugins = this.config.transform.babel.plugins.map((plugin$1) => require_helpers_options.resolveBabelPlugin(this, code, id, plugin$1)).filter((plugin$1, _, arr) => plugin$1 && !require_helpers_filters.isDuplicatePlugin(arr, plugin$1));
|
|
49
48
|
const presets = this.config.transform.babel.presets.map((preset) => require_helpers_options.resolveBabelPlugin(this, code, id, preset)).filter((preset, _, arr) => preset && !require_helpers_filters.isDuplicatePlugin(arr, preset));
|
|
50
49
|
if (Array.isArray(plugins) && plugins.length === 0 && Array.isArray(presets) && presets.length === 0) return {
|
|
51
50
|
code,
|
|
52
51
|
id
|
|
53
52
|
};
|
|
54
|
-
if ([
|
|
55
|
-
|
|
56
|
-
"cts",
|
|
57
|
-
"mts",
|
|
58
|
-
"tsx"
|
|
59
|
-
].includes((0, __stryke_path_file_path_fns.findFileExtensionSafe)(id, { fullExtension: true })) && !require_helpers_filters.isDuplicatePlugin(plugins, "@babel/plugin-syntax-typescript") && !require_helpers_filters.isDuplicatePlugin(presets, "@babel/preset-typescript")) plugins.unshift(["@babel/plugin-syntax-typescript", { isTSX: (0, __stryke_path_file_path_fns.findFileExtension)(id) === "tsx" }]);
|
|
53
|
+
if (/^(?:m|c)?tsx?$/.test((0, __stryke_path_file_path_fns.findFileExtensionSafe)(id, { fullExtension: true })) && !require_helpers_filters.isDuplicatePlugin(plugins, "@babel/plugin-syntax-typescript") && !require_helpers_filters.isDuplicatePlugin(presets, "@babel/preset-typescript")) plugins.unshift(["@babel/plugin-syntax-typescript", { isTSX: (0, __stryke_path_file_path_fns.findFileExtension)(id) === "tsx" }]);
|
|
54
|
+
this.trace(`Running babel transformations with ${plugins.length} plugins and ${presets.length} presets for file: ${id}`);
|
|
60
55
|
const result = await (0, __babel_core.transformAsync)(code, {
|
|
61
56
|
highlightCode: true,
|
|
62
57
|
code: true,
|
|
@@ -78,6 +73,7 @@ const plugin = (options = {}) => {
|
|
|
78
73
|
}).filter(Boolean)
|
|
79
74
|
});
|
|
80
75
|
if (!result?.code) throw new Error(`Powerlines - Babel plugin failed to compile ${id}`);
|
|
76
|
+
this.trace(`Completed babel transformations for file: ${id}`);
|
|
81
77
|
return {
|
|
82
78
|
code: result.code,
|
|
83
79
|
id
|
package/dist/index.mjs
CHANGED
|
@@ -41,19 +41,14 @@ const plugin = (options = {}) => {
|
|
|
41
41
|
id
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
this.debug(`Babel transforming file: ${id}`);
|
|
45
44
|
const plugins = this.config.transform.babel.plugins.map((plugin$1) => resolveBabelPlugin(this, code, id, plugin$1)).filter((plugin$1, _, arr) => plugin$1 && !isDuplicatePlugin(arr, plugin$1));
|
|
46
45
|
const presets = this.config.transform.babel.presets.map((preset) => resolveBabelPlugin(this, code, id, preset)).filter((preset, _, arr) => preset && !isDuplicatePlugin(arr, preset));
|
|
47
46
|
if (Array.isArray(plugins) && plugins.length === 0 && Array.isArray(presets) && presets.length === 0) return {
|
|
48
47
|
code,
|
|
49
48
|
id
|
|
50
49
|
};
|
|
51
|
-
if ([
|
|
52
|
-
|
|
53
|
-
"cts",
|
|
54
|
-
"mts",
|
|
55
|
-
"tsx"
|
|
56
|
-
].includes(findFileExtensionSafe(id, { fullExtension: true })) && !isDuplicatePlugin(plugins, "@babel/plugin-syntax-typescript") && !isDuplicatePlugin(presets, "@babel/preset-typescript")) plugins.unshift(["@babel/plugin-syntax-typescript", { isTSX: findFileExtension(id) === "tsx" }]);
|
|
50
|
+
if (/^(?:m|c)?tsx?$/.test(findFileExtensionSafe(id, { fullExtension: true })) && !isDuplicatePlugin(plugins, "@babel/plugin-syntax-typescript") && !isDuplicatePlugin(presets, "@babel/preset-typescript")) plugins.unshift(["@babel/plugin-syntax-typescript", { isTSX: findFileExtension(id) === "tsx" }]);
|
|
51
|
+
this.trace(`Running babel transformations with ${plugins.length} plugins and ${presets.length} presets for file: ${id}`);
|
|
57
52
|
const result = await transformAsync(code, {
|
|
58
53
|
highlightCode: true,
|
|
59
54
|
code: true,
|
|
@@ -75,6 +70,7 @@ const plugin = (options = {}) => {
|
|
|
75
70
|
}).filter(Boolean)
|
|
76
71
|
});
|
|
77
72
|
if (!result?.code) throw new Error(`Powerlines - Babel plugin failed to compile ${id}`);
|
|
73
|
+
this.trace(`Completed babel transformations for file: ${id}`);
|
|
78
74
|
return {
|
|
79
75
|
code: result.code,
|
|
80
76
|
id
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-babel",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.227",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
|
|
6
6
|
"repository": {
|
|
@@ -163,12 +163,12 @@
|
|
|
163
163
|
"chalk": "5.6.2",
|
|
164
164
|
"defu": "^6.1.4",
|
|
165
165
|
"jiti": "^2.6.1",
|
|
166
|
-
"powerlines": "^0.37.
|
|
166
|
+
"powerlines": "^0.37.91"
|
|
167
167
|
},
|
|
168
168
|
"devDependencies": {
|
|
169
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
169
|
+
"@powerlines/plugin-plugin": "^0.12.169",
|
|
170
170
|
"@types/node": "^24.10.9"
|
|
171
171
|
},
|
|
172
172
|
"publishConfig": { "access": "public" },
|
|
173
|
-
"gitHead": "
|
|
173
|
+
"gitHead": "7e6d0b942c670cdb4ad8ae8984a183702e8d87d8"
|
|
174
174
|
}
|