@modern-js/babel-compiler 2.15.0 → 2.16.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @modern-js/babel-compiler
2
2
 
3
+ ## 2.16.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 4e876ab: chore: package.json include the monorepo-relative directory
8
+
9
+ chore: 在 package.json 中声明 monorepo 的子路径
10
+
11
+ - Updated dependencies [5954330]
12
+ - Updated dependencies [7596520]
13
+ - Updated dependencies [4e876ab]
14
+ - @modern-js/utils@2.16.0
15
+
3
16
  ## 2.15.0
4
17
 
5
18
  ### Patch Changes
package/dist/cjs/build.js CHANGED
@@ -1,48 +1,25 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var build_exports = {};
19
- __export(build_exports, {
20
- build: () => build
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
21
4
  });
22
- module.exports = __toCommonJS(build_exports);
23
- var import_utils = require("@modern-js/utils");
24
- var import_constants = require("./constants");
25
- var import_compiler = require("./compiler");
5
+ Object.defineProperty(exports, "build", {
6
+ enumerable: true,
7
+ get: () => build
8
+ });
9
+ const _utils = require("@modern-js/utils");
10
+ const _constants = require("./constants");
11
+ const _compiler = require("./compiler");
26
12
  const build = async (option, babelConfig = {}) => {
27
- const {
28
- rootDir,
29
- enableVirtualDist,
30
- filenames,
31
- clean,
32
- distDir,
33
- distFileExtMap = import_constants.defaultDistFileExtMap,
34
- verbose = false,
35
- quiet = false
36
- } = option;
13
+ const { rootDir, enableVirtualDist, filenames, clean, distDir, distFileExtMap = _constants.defaultDistFileExtMap, verbose = false, quiet = false } = option;
37
14
  const virtualDists = [];
38
15
  if (clean) {
39
- await import_utils.fs.remove(distDir);
16
+ await _utils.fs.remove(distDir);
40
17
  }
41
- import_utils.fs.ensureDir(distDir);
18
+ _utils.fs.ensureDir(distDir);
42
19
  const messageDetails = [];
43
20
  for (const filename of filenames) {
44
21
  try {
45
- const dist = (0, import_compiler.compiler)({
22
+ const dist = (0, _compiler.compiler)({
46
23
  rootDir,
47
24
  enableVirtualDist,
48
25
  filepath: filename,
@@ -65,13 +42,9 @@ const build = async (option, babelConfig = {}) => {
65
42
  const happenError = messageDetails.length > 0;
66
43
  if (!quiet) {
67
44
  if (happenError) {
68
- import_utils.logger.error(
69
- `Compilation failure ${messageDetails.length} ${messageDetails.length !== 1 ? "files" : "file"} with Babel.`
70
- );
45
+ _utils.logger.error(`Compilation failure ${messageDetails.length} ${messageDetails.length !== 1 ? "files" : "file"} with Babel.`);
71
46
  } else {
72
- import_utils.logger.info(
73
- `Successfully compiled ${filenames.length} ${filenames.length !== 1 ? "files" : "file"} with Babel.`
74
- );
47
+ _utils.logger.info(`Successfully compiled ${filenames.length} ${filenames.length !== 1 ? "files" : "file"} with Babel.`);
75
48
  }
76
49
  }
77
50
  if (happenError) {
@@ -87,7 +60,3 @@ const build = async (option, babelConfig = {}) => {
87
60
  virtualDists
88
61
  };
89
62
  };
90
- // Annotate the CommonJS export names for ESM import in node:
91
- 0 && (module.exports = {
92
- build
93
- });
@@ -1,49 +1,84 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
8
6
  for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var buildWatch_exports = {};
29
- __export(buildWatch_exports, {
30
- BuildWatchEmitter: () => BuildWatchEmitter,
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
31
13
  BuildWatchEvent: () => BuildWatchEvent,
32
- buildWatch: () => buildWatch,
33
- runBuildWatch: () => runBuildWatch
14
+ BuildWatchEmitter: () => BuildWatchEmitter,
15
+ runBuildWatch: () => runBuildWatch,
16
+ buildWatch: () => buildWatch
34
17
  });
35
- module.exports = __toCommonJS(buildWatch_exports);
36
- var path = __toESM(require("path"));
37
- var Event = __toESM(require("events"));
38
- var import_utils = require("@modern-js/utils");
39
- var import_build = require("./build");
40
- var import_compilerErrorResult = require("./compilerErrorResult");
18
+ const _path = /* @__PURE__ */ _interop_require_wildcard(require("path"));
19
+ const _events = /* @__PURE__ */ _interop_require_wildcard(require("events"));
20
+ const _utils = require("@modern-js/utils");
21
+ const _build = require("./build");
22
+ const _compilerErrorResult = require("./compilerErrorResult");
23
+ function _define_property(obj, key, value) {
24
+ if (key in obj) {
25
+ Object.defineProperty(obj, key, {
26
+ value,
27
+ enumerable: true,
28
+ configurable: true,
29
+ writable: true
30
+ });
31
+ } else {
32
+ obj[key] = value;
33
+ }
34
+ return obj;
35
+ }
36
+ function _getRequireWildcardCache(nodeInterop) {
37
+ if (typeof WeakMap !== "function")
38
+ return null;
39
+ var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
40
+ var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
41
+ return (_getRequireWildcardCache = function(nodeInterop2) {
42
+ return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
43
+ })(nodeInterop);
44
+ }
45
+ function _interop_require_wildcard(obj, nodeInterop) {
46
+ if (!nodeInterop && obj && obj.__esModule) {
47
+ return obj;
48
+ }
49
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
50
+ return {
51
+ default: obj
52
+ };
53
+ }
54
+ var cache = _getRequireWildcardCache(nodeInterop);
55
+ if (cache && cache.has(obj)) {
56
+ return cache.get(obj);
57
+ }
58
+ var newObj = {};
59
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
60
+ for (var key in obj) {
61
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
62
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
63
+ if (desc && (desc.get || desc.set)) {
64
+ Object.defineProperty(newObj, key, desc);
65
+ } else {
66
+ newObj[key] = obj[key];
67
+ }
68
+ }
69
+ }
70
+ newObj.default = obj;
71
+ if (cache) {
72
+ cache.set(obj, newObj);
73
+ }
74
+ return newObj;
75
+ }
41
76
  const BuildWatchEvent = {
42
77
  firstCompiler: "first-compiler",
43
78
  compiling: "compiling",
44
79
  watchingCompiler: "watching-compiler"
45
80
  };
46
- class BuildWatchEmitter extends Event.EventEmitter {
81
+ class BuildWatchEmitter extends _events.EventEmitter {
47
82
  setInitFn(fn) {
48
83
  this._initFn = fn;
49
84
  }
@@ -53,13 +88,17 @@ class BuildWatchEmitter extends Event.EventEmitter {
53
88
  }
54
89
  return null;
55
90
  }
91
+ constructor(...args) {
92
+ super(...args);
93
+ _define_property(this, "_initFn", void 0);
94
+ }
56
95
  }
57
96
  const runBuildWatch = async (option, babelConfig = {}, emitter) => {
58
97
  emitter.emit(BuildWatchEvent.compiling);
59
- const errorResult = new import_compilerErrorResult.CompilerErrorResult();
98
+ const errorResult = new _compilerErrorResult.CompilerErrorResult();
60
99
  const watchDir = option.watchDir;
61
100
  const { distDir, quiet } = option;
62
- const firstBuildResult = await (0, import_build.build)(option, babelConfig);
101
+ const firstBuildResult = await (0, _build.build)(option, babelConfig);
63
102
  const { code } = firstBuildResult;
64
103
  if (code === 1) {
65
104
  errorResult.init(firstBuildResult);
@@ -67,61 +106,52 @@ const runBuildWatch = async (option, babelConfig = {}, emitter) => {
67
106
  } else {
68
107
  emitter.emit(BuildWatchEvent.firstCompiler, firstBuildResult);
69
108
  }
70
- return (0, import_utils.watch)(
71
- `${watchDir}/**/*.{js,jsx,ts,tsx}`,
72
- async ({ changeType, changedFilePath }) => {
73
- emitter.emit(BuildWatchEvent.compiling);
74
- if (changeType === import_utils.WatchChangeType.UNLINK) {
75
- const removeFiles = [
76
- path.normalize(
77
- `./${distDir}/${path.relative(watchDir, changedFilePath)}`
78
- )
79
- ];
80
- if (!quiet) {
81
- import_utils.logger.info(`remove file: ${removeFiles.join(",")}`);
82
- }
83
- const result2 = {
84
- code: 0,
85
- message: `remove file: ${removeFiles.join(",")}`,
86
- removeFiles
87
- };
88
- emitter.emit(BuildWatchEvent.watchingCompiler, result2);
89
- return;
109
+ return (0, _utils.watch)(`${watchDir}/**/*.{js,jsx,ts,tsx}`, async ({ changeType, changedFilePath }) => {
110
+ emitter.emit(BuildWatchEvent.compiling);
111
+ if (changeType === _utils.WatchChangeType.UNLINK) {
112
+ const removeFiles = [
113
+ _path.normalize(`./${distDir}/${_path.relative(watchDir, changedFilePath)}`)
114
+ ];
115
+ if (!quiet) {
116
+ _utils.logger.info(`remove file: ${removeFiles.join(",")}`);
90
117
  }
91
- const result = await (0, import_build.build)(
92
- { ...option, filenames: [changedFilePath] },
93
- babelConfig
94
- );
95
- if (result.code === 1) {
96
- errorResult.update(result.messageDetails || []);
97
- emitter.emit(BuildWatchEvent.watchingCompiler, errorResult.value);
98
- !quiet && import_utils.logger.info(errorResult.value.message);
118
+ const result2 = {
119
+ code: 0,
120
+ message: `remove file: ${removeFiles.join(",")}`,
121
+ removeFiles
122
+ };
123
+ emitter.emit(BuildWatchEvent.watchingCompiler, result2);
124
+ return;
125
+ }
126
+ const result = await (0, _build.build)({
127
+ ...option,
128
+ filenames: [
129
+ changedFilePath
130
+ ]
131
+ }, babelConfig);
132
+ if (result.code === 1) {
133
+ errorResult.update(result.messageDetails || []);
134
+ emitter.emit(BuildWatchEvent.watchingCompiler, errorResult.value);
135
+ !quiet && _utils.logger.info(errorResult.value.message);
136
+ } else {
137
+ errorResult.removeByFileName(changedFilePath);
138
+ if (errorResult.checkExistError()) {
139
+ emitter.emit(BuildWatchEvent.watchingCompiler, {
140
+ ...errorResult.value,
141
+ virtualDists: result.virtualDists
142
+ });
143
+ !quiet && _utils.logger.info(errorResult.value.message);
99
144
  } else {
100
- errorResult.removeByFileName(changedFilePath);
101
- if (errorResult.checkExistError()) {
102
- emitter.emit(BuildWatchEvent.watchingCompiler, {
103
- ...errorResult.value,
104
- virtualDists: result.virtualDists
105
- });
106
- !quiet && import_utils.logger.info(errorResult.value.message);
107
- } else {
108
- emitter.emit(BuildWatchEvent.watchingCompiler, result);
109
- !quiet && import_utils.logger.info(result.message);
110
- }
145
+ emitter.emit(BuildWatchEvent.watchingCompiler, result);
146
+ !quiet && _utils.logger.info(result.message);
111
147
  }
112
- },
113
- [`${watchDir}/**/*.d.ts`]
114
- );
148
+ }
149
+ }, [
150
+ `${watchDir}/**/*.d.ts`
151
+ ]);
115
152
  };
116
153
  const buildWatch = (option, babelConfig = {}) => {
117
154
  const buildWatchEmitter = new BuildWatchEmitter();
118
155
  buildWatchEmitter.setInitFn(runBuildWatch.bind(null, option, babelConfig));
119
156
  return buildWatchEmitter;
120
157
  };
121
- // Annotate the CommonJS export names for ESM import in node:
122
- 0 && (module.exports = {
123
- BuildWatchEmitter,
124
- BuildWatchEvent,
125
- buildWatch,
126
- runBuildWatch
127
- });
@@ -1,66 +1,80 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
8
6
  for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var compiler_exports = {};
29
- __export(compiler_exports, {
30
- compiler: () => compiler,
31
- getDistFilePath: () => getDistFilePath,
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
32
13
  isRes: () => isRes,
33
- resolveSourceMap: () => resolveSourceMap
14
+ getDistFilePath: () => getDistFilePath,
15
+ resolveSourceMap: () => resolveSourceMap,
16
+ compiler: () => compiler
34
17
  });
35
- module.exports = __toCommonJS(compiler_exports);
36
- var path = __toESM(require("path"));
37
- var babel = __toESM(require("@babel/core"));
38
- var import_utils = require("@modern-js/utils");
39
- var utils = __toESM(require("./utils"));
40
- var import_constants = require("./constants");
18
+ const _path = /* @__PURE__ */ _interop_require_wildcard(require("path"));
19
+ const _core = /* @__PURE__ */ _interop_require_wildcard(require("@babel/core"));
20
+ const _utils = require("@modern-js/utils");
21
+ const _utils1 = /* @__PURE__ */ _interop_require_wildcard(require("./utils"));
22
+ const _constants = require("./constants");
23
+ function _getRequireWildcardCache(nodeInterop) {
24
+ if (typeof WeakMap !== "function")
25
+ return null;
26
+ var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
27
+ var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
28
+ return (_getRequireWildcardCache = function(nodeInterop2) {
29
+ return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
30
+ })(nodeInterop);
31
+ }
32
+ function _interop_require_wildcard(obj, nodeInterop) {
33
+ if (!nodeInterop && obj && obj.__esModule) {
34
+ return obj;
35
+ }
36
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
37
+ return {
38
+ default: obj
39
+ };
40
+ }
41
+ var cache = _getRequireWildcardCache(nodeInterop);
42
+ if (cache && cache.has(obj)) {
43
+ return cache.get(obj);
44
+ }
45
+ var newObj = {};
46
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
47
+ for (var key in obj) {
48
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
49
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
50
+ if (desc && (desc.get || desc.set)) {
51
+ Object.defineProperty(newObj, key, desc);
52
+ } else {
53
+ newObj[key] = obj[key];
54
+ }
55
+ }
56
+ }
57
+ newObj.default = obj;
58
+ if (cache) {
59
+ cache.set(obj, newObj);
60
+ }
61
+ return newObj;
62
+ }
41
63
  const defaultDistDir = "dist";
42
64
  const isRes = (r) => Boolean(r);
43
65
  const getDistFilePath = (option) => {
44
66
  const { filepath, rootDir, distDir, extMap } = option;
45
- const ext = path.extname(filepath);
46
- return path.join(
47
- distDir,
48
- path.relative(rootDir, filepath).replace(ext, extMap[ext])
49
- );
67
+ const ext = _path.extname(filepath);
68
+ return _path.join(distDir, _path.relative(rootDir, filepath).replace(ext, extMap[ext]));
50
69
  };
51
70
  const resolveSourceMap = (option) => {
52
- const {
53
- babelRes,
54
- sourceFilePath,
55
- distFilePath,
56
- enableVirtualDist = false
57
- } = option;
71
+ const { babelRes, sourceFilePath, distFilePath, enableVirtualDist = false } = option;
58
72
  const mapLoc = `${distFilePath}.map`;
59
- babelRes.code = utils.addSourceMappingUrl(babelRes.code, mapLoc);
73
+ babelRes.code = _utils1.addSourceMappingUrl(babelRes.code, mapLoc);
60
74
  if (babelRes.map) {
61
- babelRes.map.file = path.basename(distFilePath);
75
+ babelRes.map.file = _path.basename(distFilePath);
62
76
  babelRes.map.sources = [
63
- path.relative(path.dirname(distFilePath), sourceFilePath)
77
+ _path.relative(_path.dirname(distFilePath), sourceFilePath)
64
78
  ];
65
79
  }
66
80
  const sourceMapVirtualDist = {
@@ -70,22 +84,13 @@ const resolveSourceMap = (option) => {
70
84
  if (enableVirtualDist) {
71
85
  return sourceMapVirtualDist;
72
86
  }
73
- import_utils.fs.ensureDirSync(path.dirname(mapLoc));
74
- import_utils.fs.writeFileSync(mapLoc, JSON.stringify(babelRes.map));
87
+ _utils.fs.ensureDirSync(_path.dirname(mapLoc));
88
+ _utils.fs.writeFileSync(mapLoc, JSON.stringify(babelRes.map));
75
89
  return sourceMapVirtualDist;
76
90
  };
77
91
  const compiler = (option) => {
78
- const {
79
- filepath,
80
- rootDir,
81
- enableVirtualDist = false,
82
- distDir = path.join(path.dirname(rootDir), defaultDistDir),
83
- verbose = false,
84
- babelConfig = {},
85
- distFileExtMap = import_constants.defaultDistFileExtMap,
86
- quiet = false
87
- } = option;
88
- const babelRes = babel.transformFileSync(filepath, babelConfig);
92
+ const { filepath, rootDir, enableVirtualDist = false, distDir = _path.join(_path.dirname(rootDir), defaultDistDir), verbose = false, babelConfig = {}, distFileExtMap = _constants.defaultDistFileExtMap, quiet = false } = option;
93
+ const babelRes = _core.transformFileSync(filepath, babelConfig);
89
94
  let virtualDist = null;
90
95
  if (!isRes(babelRes)) {
91
96
  throw new Error(`${filepath} happen error`);
@@ -104,7 +109,7 @@ const compiler = (option) => {
104
109
  sourcemap: ""
105
110
  };
106
111
  }
107
- if ((babelRes == null ? void 0 : babelRes.map) && babelConfig.sourceMaps && babelConfig.sourceMaps !== "inline") {
112
+ if ((babelRes === null || babelRes === void 0 ? void 0 : babelRes.map) && babelConfig.sourceMaps && babelConfig.sourceMaps !== "inline") {
108
113
  if (virtualDist) {
109
114
  virtualDist = {
110
115
  ...virtualDist,
@@ -131,18 +136,11 @@ const compiler = (option) => {
131
136
  code: babelRes.code
132
137
  };
133
138
  } else {
134
- import_utils.fs.ensureDirSync(path.dirname(distFilePath));
135
- import_utils.fs.writeFileSync(distFilePath, babelRes.code);
139
+ _utils.fs.ensureDirSync(_path.dirname(distFilePath));
140
+ _utils.fs.writeFileSync(distFilePath, babelRes.code);
136
141
  }
137
142
  if (verbose && !quiet) {
138
- import_utils.logger.info(`${filepath} => ${distFilePath}`);
143
+ _utils.logger.info(`${filepath} => ${distFilePath}`);
139
144
  }
140
145
  return virtualDist;
141
146
  };
142
- // Annotate the CommonJS export names for ESM import in node:
143
- 0 && (module.exports = {
144
- compiler,
145
- getDistFilePath,
146
- isRes,
147
- resolveSourceMap
148
- });
@@ -1,31 +1,27 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var compilerErrorResult_exports = {};
19
- __export(compilerErrorResult_exports, {
20
- CompilerErrorResult: () => CompilerErrorResult
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
21
4
  });
22
- module.exports = __toCommonJS(compilerErrorResult_exports);
23
- class CompilerErrorResult {
24
- constructor(initErrorResult) {
25
- this.init(initErrorResult);
5
+ Object.defineProperty(exports, "CompilerErrorResult", {
6
+ enumerable: true,
7
+ get: () => CompilerErrorResult
8
+ });
9
+ function _define_property(obj, key, value) {
10
+ if (key in obj) {
11
+ Object.defineProperty(obj, key, {
12
+ value,
13
+ enumerable: true,
14
+ configurable: true,
15
+ writable: true
16
+ });
17
+ } else {
18
+ obj[key] = value;
26
19
  }
20
+ return obj;
21
+ }
22
+ class CompilerErrorResult {
27
23
  init(initErrorResult) {
28
- this._messageDetails = (initErrorResult == null ? void 0 : initErrorResult.messageDetails) || [];
24
+ this._messageDetails = (initErrorResult === null || initErrorResult === void 0 ? void 0 : initErrorResult.messageDetails) || [];
29
25
  }
30
26
  update(messageDetails) {
31
27
  for (const messageDetail of messageDetails) {
@@ -42,23 +38,21 @@ class CompilerErrorResult {
42
38
  }
43
39
  }
44
40
  removeByFileName(filename) {
45
- this._messageDetails = this._messageDetails.filter(
46
- (detail) => detail.filename !== filename
47
- );
41
+ this._messageDetails = this._messageDetails.filter((detail) => detail.filename !== filename);
48
42
  }
49
43
  get value() {
50
- var _a;
44
+ var _this__messageDetails;
51
45
  return {
52
46
  code: 1,
53
- message: `Compilation failure ${(_a = this._messageDetails) == null ? void 0 : _a.length} files with Babel.`,
47
+ message: `Compilation failure ${(_this__messageDetails = this._messageDetails) === null || _this__messageDetails === void 0 ? void 0 : _this__messageDetails.length} files with Babel.`,
54
48
  messageDetails: this._messageDetails
55
49
  };
56
50
  }
57
51
  checkExistError() {
58
52
  return this._messageDetails.length > 0;
59
53
  }
54
+ constructor(initErrorResult) {
55
+ _define_property(this, "_messageDetails", void 0);
56
+ this.init(initErrorResult);
57
+ }
60
58
  }
61
- // Annotate the CommonJS export names for ESM import in node:
62
- 0 && (module.exports = {
63
- CompilerErrorResult
64
- });
@@ -1,32 +1,14 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var constants_exports = {};
19
- __export(constants_exports, {
20
- defaultDistFileExtMap: () => defaultDistFileExtMap
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "defaultDistFileExtMap", {
6
+ enumerable: true,
7
+ get: () => defaultDistFileExtMap
21
8
  });
22
- module.exports = __toCommonJS(constants_exports);
23
9
  const defaultDistFileExtMap = {
24
10
  ".js": ".js",
25
11
  ".jsx": ".js",
26
12
  ".ts": ".js",
27
13
  ".tsx": ".js"
28
14
  };
29
- // Annotate the CommonJS export names for ESM import in node:
30
- 0 && (module.exports = {
31
- defaultDistFileExtMap
32
- });