@modern-js/plugin-module-babel 2.48.4 → 2.48.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/index.d.ts CHANGED
@@ -1,12 +1,15 @@
1
- import type { TransformOptions as BabelTransformOptions } from '@babel/core';
2
- import { CliPlugin, ICompiler, ModuleTools } from '@modern-js/module-tools';
3
- export declare const getBabelHook: (options?: BabelTransformOptions) => {
1
+ import { TransformOptions } from '@babel/core';
2
+ import { ICompiler, CliPlugin, ModuleTools } from '@modern-js/module-tools';
3
+
4
+ declare const getBabelHook: (options?: TransformOptions) => {
4
5
  name: string;
5
6
  apply(compiler: ICompiler): void;
6
7
  };
7
- export declare const modulePluginBabel: (options?: BabelTransformOptions) => CliPlugin<ModuleTools>;
8
+ declare const modulePluginBabel: (options?: TransformOptions) => CliPlugin<ModuleTools>;
8
9
  /**
9
10
  * deprecated named export, use modulePluginBabel instead.
10
11
  * @deprecated
11
12
  */
12
- export declare const ModulePluginBabel: (options?: BabelTransformOptions) => CliPlugin<ModuleTools>;
13
+ declare const ModulePluginBabel: (options?: TransformOptions) => CliPlugin<ModuleTools>;
14
+
15
+ export { ModulePluginBabel, getBabelHook, modulePluginBabel };
package/dist/index.js CHANGED
@@ -1,8 +1,13 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
6
11
  var __export = (target, all) => {
7
12
  for (var name2 in all)
8
13
  __defProp(target, name2, { get: all[name2], enumerable: true });
@@ -15,7 +20,65 @@ var __copyProps = (to, from, except, desc) => {
15
20
  }
16
21
  return to;
17
22
  };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
18
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // ../../solutions/module-tools/dist/utils/assert.js
34
+ var require_assert = __commonJS({
35
+ "../../solutions/module-tools/dist/utils/assert.js"(exports, module2) {
36
+ "use strict";
37
+ var __defProp2 = Object.defineProperty;
38
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
39
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
40
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
41
+ var __export2 = (target, all) => {
42
+ for (var name2 in all)
43
+ __defProp2(target, name2, { get: all[name2], enumerable: true });
44
+ };
45
+ var __copyProps2 = (to, from, except, desc) => {
46
+ if (from && typeof from === "object" || typeof from === "function") {
47
+ for (let key of __getOwnPropNames2(from))
48
+ if (!__hasOwnProp2.call(to, key) && key !== except)
49
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
50
+ }
51
+ return to;
52
+ };
53
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
54
+ var assert_exports = {};
55
+ __export2(assert_exports, {
56
+ isJsExt: () => isJsExt2,
57
+ isJsLoader: () => isJsLoader2,
58
+ isStyleExt: () => isStyleExt,
59
+ isTsExt: () => isTsExt,
60
+ isTsLoader: () => isTsLoader
61
+ });
62
+ module2.exports = __toCommonJS2(assert_exports);
63
+ function isStyleExt(path) {
64
+ return /\.(c|le|sa|sc)ss(\?.*)?$/.test(path);
65
+ }
66
+ function isJsExt2(path) {
67
+ return /\.(m|c)?(j|t)sx?(\?.*)?$/.test(path);
68
+ }
69
+ function isJsLoader2(loader) {
70
+ return loader === "js" || loader === "ts" || loader === "tsx" || loader === "jsx";
71
+ }
72
+ function isTsExt(path) {
73
+ return /\.(m|c)?tsx?(\?.*)?$/.test(path);
74
+ }
75
+ function isTsLoader(loader) {
76
+ return loader === "ts" || loader === "tsx";
77
+ }
78
+ }
79
+ });
80
+
81
+ // src/index.ts
19
82
  var src_exports = {};
20
83
  __export(src_exports, {
21
84
  ModulePluginBabel: () => ModulePluginBabel,
@@ -23,15 +86,13 @@ __export(src_exports, {
23
86
  modulePluginBabel: () => modulePluginBabel
24
87
  });
25
88
  module.exports = __toCommonJS(src_exports);
26
- var import_module_tools = require("@modern-js/module-tools");
27
- const name = "babel";
28
- const getBabelHook = (options) => ({
89
+ var import_utils = __toESM(require_assert());
90
+ var name = "babel";
91
+ var getBabelHook = (options) => ({
29
92
  name,
30
93
  apply(compiler) {
31
- compiler.hooks.transform.tapPromise({
32
- name
33
- }, async (args) => {
34
- if ((0, import_module_tools.isJsExt)(args.path) || (0, import_module_tools.isJsLoader)(args.loader)) {
94
+ compiler.hooks.transform.tapPromise({ name }, async (args) => {
95
+ if ((0, import_utils.isJsExt)(args.path) || (0, import_utils.isJsLoader)(args.loader)) {
35
96
  const result = await require("@babel/core").transformAsync(args.code, {
36
97
  filename: args.path,
37
98
  sourceMaps: Boolean(compiler.config.sourceMap),
@@ -40,22 +101,20 @@ const getBabelHook = (options) => ({
40
101
  babelrc: false,
41
102
  configFile: false,
42
103
  compact: false,
43
- exclude: [
44
- /\bcore-js\b/
45
- ],
104
+ exclude: [/\bcore-js\b/],
46
105
  ...options
47
106
  });
48
107
  return {
49
108
  ...args,
50
- code: result === null || result === void 0 ? void 0 : result.code,
51
- map: result === null || result === void 0 ? void 0 : result.map
109
+ code: result == null ? void 0 : result.code,
110
+ map: result == null ? void 0 : result.map
52
111
  };
53
112
  }
54
113
  return args;
55
114
  });
56
115
  }
57
116
  });
58
- const modulePluginBabel = (options) => ({
117
+ var modulePluginBabel = (options) => ({
59
118
  name: "babel-plugin",
60
119
  setup: () => ({
61
120
  beforeBuildTask(config) {
@@ -65,7 +124,7 @@ const modulePluginBabel = (options) => ({
65
124
  }
66
125
  })
67
126
  });
68
- const ModulePluginBabel = modulePluginBabel;
127
+ var ModulePluginBabel = modulePluginBabel;
69
128
  // Annotate the CommonJS export names for ESM import in node:
70
129
  0 && (module.exports = {
71
130
  ModulePluginBabel,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/plugin-module-babel",
3
- "version": "2.48.4",
3
+ "version": "2.48.5",
4
4
  "description": "The babel plugin of Modern.js Module",
5
5
  "keywords": [
6
6
  "react",
@@ -29,12 +29,12 @@
29
29
  "@types/node": "^14",
30
30
  "jest": "^29",
31
31
  "typescript": "^5",
32
- "@scripts/build": "2.48.4",
33
- "@modern-js/module-tools": "2.48.4",
34
- "@scripts/jest-config": "2.48.4"
32
+ "@modern-js/module-tools": "2.48.5",
33
+ "@scripts/jest-config": "2.48.5",
34
+ "@scripts/build": "2.48.5"
35
35
  },
36
36
  "peerDependencies": {
37
- "@modern-js/module-tools": "^2.48.4"
37
+ "@modern-js/module-tools": "^2.48.5"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public",