@modern-js/server-utils 2.0.0-beta.3 → 2.0.0-beta.6

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.
@@ -1,105 +1,150 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __export = (target, all) => {
22
+ for (var name in all)
23
+ __defProp(target, name, { get: all[name], enumerable: true });
24
+ };
25
+ var __copyProps = (to, from, except, desc) => {
26
+ if (from && typeof from === "object" || typeof from === "function") {
27
+ for (let key of __getOwnPropNames(from))
28
+ if (!__hasOwnProp.call(to, key) && key !== except)
29
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
30
+ }
31
+ return to;
32
+ };
33
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
34
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
+ mod
36
+ ));
37
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
+ var __async = (__this, __arguments, generator) => {
39
+ return new Promise((resolve, reject) => {
40
+ var fulfilled = (value) => {
41
+ try {
42
+ step(generator.next(value));
43
+ } catch (e) {
44
+ reject(e);
45
+ }
46
+ };
47
+ var rejected = (value) => {
48
+ try {
49
+ step(generator.throw(value));
50
+ } catch (e) {
51
+ reject(e);
52
+ }
53
+ };
54
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
55
+ step((generator = generator.apply(__this, __arguments)).next());
56
+ });
57
+ };
58
+ var typescript_exports = {};
59
+ __export(typescript_exports, {
60
+ compileByTs: () => compileByTs
5
61
  });
6
- exports.compileByTs = void 0;
7
- var _path = _interopRequireDefault(require("path"));
8
- var _utils = require("@modern-js/utils");
9
- var _typescript = _interopRequireDefault(require("typescript"));
10
- var _typescriptLoader = require("./typescript-loader");
11
- var _tsconfigPathsPlugin = require("./tsconfig-paths-plugin");
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
- const readTsConfigByFile = tsConfigFile => {
17
- const parsedCmd = _typescript.default.getParsedCommandLineOfConfigFile(tsConfigFile, undefined, _typescript.default.sys);
18
- const {
19
- options,
20
- fileNames,
21
- projectReferences
22
- } = parsedCmd;
23
- return {
24
- options,
25
- fileNames,
26
- projectReferences
27
- };
62
+ module.exports = __toCommonJS(typescript_exports);
63
+ var import_path = __toESM(require("path"));
64
+ var import_utils = require("@modern-js/utils");
65
+ var import_typescript = __toESM(require("typescript"));
66
+ var import_typescript_loader = require("./typescript-loader");
67
+ var import_tsconfig_paths_plugin = require("./tsconfig-paths-plugin");
68
+ const readTsConfigByFile = (tsConfigFile) => {
69
+ const parsedCmd = import_typescript.default.getParsedCommandLineOfConfigFile(
70
+ tsConfigFile,
71
+ void 0,
72
+ import_typescript.default.sys
73
+ );
74
+ const { options, fileNames, projectReferences } = parsedCmd;
75
+ return { options, fileNames, projectReferences };
28
76
  };
29
- const copyFiles = async (from, to, tsconfigPath) => {
30
- if (await _utils.fs.pathExists(from)) {
31
- const basename = _path.default.basename(from);
32
- const targetDir = _path.default.join(to, basename);
33
- await _utils.fs.copy(from, targetDir, {
34
- filter: src => !['.ts'].includes(_path.default.extname(src)) && src !== tsconfigPath
77
+ const copyFiles = (from, to, tsconfigPath) => __async(void 0, null, function* () {
78
+ if (yield import_utils.fs.pathExists(from)) {
79
+ const basename = import_path.default.basename(from);
80
+ const targetDir = import_path.default.join(to, basename);
81
+ yield import_utils.fs.copy(from, targetDir, {
82
+ filter: (src) => ![".ts"].includes(import_path.default.extname(src)) && src !== tsconfigPath
35
83
  });
36
84
  }
37
- };
38
- const compileByTs = async (appDirectory, config, compileOptions) => {
39
- _utils.logger.info(`Running ts compile...`);
40
- const {
41
- sourceDirs,
42
- distDir,
43
- tsconfigPath
44
- } = compileOptions;
85
+ });
86
+ const compileByTs = (appDirectory, config, compileOptions) => __async(void 0, null, function* () {
87
+ import_utils.logger.info(`Running ts compile...`);
88
+ const { sourceDirs, distDir, tsconfigPath } = compileOptions;
45
89
  if (!tsconfigPath) {
46
90
  return;
47
91
  }
48
- const ts = new _typescriptLoader.TypescriptLoader({
92
+ const ts2 = new import_typescript_loader.TypescriptLoader({
49
93
  appDirectory
50
94
  }).load();
51
- const createProgram = ts.createIncrementalProgram || ts.createProgram;
52
- const formatHost = getFormatHost(ts);
53
- const {
54
- alias
55
- } = config;
56
- const aliasOption = (0, _utils.getAliasConfig)(alias, {
95
+ const createProgram = ts2.createIncrementalProgram || ts2.createProgram;
96
+ const formatHost = getFormatHost(ts2);
97
+ const { alias } = config;
98
+ const aliasOption = (0, import_utils.getAliasConfig)(alias, {
57
99
  appDirectory,
58
100
  tsconfigPath
59
101
  });
60
- const {
61
- paths = {},
62
- absoluteBaseUrl = './'
63
- } = aliasOption;
64
- const {
65
- options,
66
- fileNames,
67
- projectReferences
68
- } = readTsConfigByFile(tsconfigPath);
69
- const sourcePosixPaths = sourceDirs.map(sourceDir => sourceDir.split(_path.default.sep).join(_path.default.posix.sep));
70
- const rootNames = fileNames.filter(fileName => {
71
- return fileName.endsWith('.d.ts') || sourcePosixPaths.some(sourceDir => {
102
+ const { paths = {}, absoluteBaseUrl = "./" } = aliasOption;
103
+ const { options, fileNames, projectReferences } = readTsConfigByFile(tsconfigPath);
104
+ const sourcePosixPaths = sourceDirs.map(
105
+ (sourceDir) => sourceDir.split(import_path.default.sep).join(import_path.default.posix.sep)
106
+ );
107
+ const rootNames = fileNames.filter((fileName) => {
108
+ return fileName.endsWith(".d.ts") || sourcePosixPaths.some((sourceDir) => {
72
109
  return fileName.includes(sourceDir);
73
110
  });
74
111
  });
75
- const program = createProgram.call(ts, {
112
+ const program = createProgram.call(ts2, {
76
113
  rootNames,
77
114
  projectReferences,
78
- options: _objectSpread({
115
+ options: __spreadValues({
79
116
  rootDir: appDirectory,
80
117
  outDir: distDir
81
118
  }, options)
82
119
  });
83
- const tsconfigPathsPlugin = (0, _tsconfigPathsPlugin.tsconfigPathsBeforeHookFactory)(ts, absoluteBaseUrl, paths);
84
- const emitResult = program.emit(undefined, undefined, undefined, undefined, {
120
+ const tsconfigPathsPlugin = (0, import_tsconfig_paths_plugin.tsconfigPathsBeforeHookFactory)(
121
+ ts2,
122
+ absoluteBaseUrl,
123
+ paths
124
+ );
125
+ const emitResult = program.emit(void 0, void 0, void 0, void 0, {
85
126
  before: [tsconfigPathsPlugin]
86
127
  });
87
- const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
128
+ const allDiagnostics = ts2.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
88
129
  if (allDiagnostics.length > 0) {
89
- _utils.logger.error(ts.formatDiagnosticsWithColorAndContext(allDiagnostics, formatHost));
90
- // eslint-disable-next-line no-process-exit
130
+ import_utils.logger.error(
131
+ ts2.formatDiagnosticsWithColorAndContext(allDiagnostics, formatHost)
132
+ );
91
133
  process.exit(1);
92
134
  }
93
135
  for (const source of sourceDirs) {
94
- await copyFiles(source, distDir, tsconfigPath);
136
+ yield copyFiles(source, distDir, tsconfigPath);
95
137
  }
96
- _utils.logger.info(`Ts compile succeed`);
97
- };
98
- exports.compileByTs = compileByTs;
99
- const getFormatHost = ts => {
138
+ import_utils.logger.info(`Ts compile succeed`);
139
+ });
140
+ const getFormatHost = (ts2) => {
100
141
  return {
101
- getCanonicalFileName: path => path,
102
- getCurrentDirectory: ts.sys.getCurrentDirectory,
103
- getNewLine: () => ts.sys.newLine
142
+ getCanonicalFileName: (path2) => path2,
143
+ getCurrentDirectory: ts2.sys.getCurrentDirectory,
144
+ getNewLine: () => ts2.sys.newLine
104
145
  };
105
- };
146
+ };
147
+ // Annotate the CommonJS export names for ESM import in node:
148
+ 0 && (module.exports = {
149
+ compileByTs
150
+ });
@@ -1,22 +1,41 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
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) => {
8
+ 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
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+ var tsconfig_paths_plugin_exports = {};
25
+ __export(tsconfig_paths_plugin_exports, {
26
+ tsconfigPathsBeforeHookFactory: () => tsconfigPathsBeforeHookFactory
5
27
  });
6
- exports.tsconfigPathsBeforeHookFactory = tsconfigPathsBeforeHookFactory;
7
- var os = _interopRequireWildcard(require("os"));
8
- var _path = _interopRequireWildcard(require("path"));
9
- var ts = _interopRequireWildcard(require("typescript"));
10
- var _tsconfigPaths = require("@modern-js/utils/tsconfig-paths");
11
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
- const isRegExpKey = str => {
14
- return str.startsWith('^') || str.endsWith('$');
28
+ module.exports = __toCommonJS(tsconfig_paths_plugin_exports);
29
+ var os = __toESM(require("os"));
30
+ var import_path = __toESM(require("path"));
31
+ var ts = __toESM(require("typescript"));
32
+ var import_tsconfig_paths = require("@modern-js/utils/tsconfig-paths");
33
+ const isRegExpKey = (str) => {
34
+ return str.startsWith("^") || str.endsWith("$");
15
35
  };
16
36
  const resolveAliasPath = (baseUrl, filePath) => {
17
- // exclude absolute path and alias
18
- if (filePath.startsWith('.') || filePath.startsWith('..')) {
19
- return _path.default.resolve(baseUrl, filePath);
37
+ if (filePath.startsWith(".") || filePath.startsWith("..")) {
38
+ return import_path.default.resolve(baseUrl, filePath);
20
39
  }
21
40
  return filePath;
22
41
  };
@@ -32,10 +51,8 @@ const createAliasMatcher = (baseUrl, alias) => {
32
51
  }
33
52
  return o;
34
53
  }, []);
35
- const cacheMap = new Map();
36
-
37
- // eslint-disable-next-line consistent-return
38
- return requestedModule => {
54
+ const cacheMap = /* @__PURE__ */ new Map();
55
+ return (requestedModule) => {
39
56
  if (cacheMap.has(requestedModule)) {
40
57
  return cacheMap.get(requestedModule);
41
58
  }
@@ -59,7 +76,7 @@ const isDynamicImport = (tsBinary, node) => {
59
76
  function tsconfigPathsBeforeHookFactory(tsBinary, baseUrl, paths) {
60
77
  const tsPaths = {};
61
78
  const alias = {};
62
- Object.keys(paths).forEach(key => {
79
+ Object.keys(paths).forEach((key) => {
63
80
  if (Array.isArray(paths[key])) {
64
81
  tsPaths[key] = paths[key];
65
82
  } else {
@@ -67,37 +84,55 @@ function tsconfigPathsBeforeHookFactory(tsBinary, baseUrl, paths) {
67
84
  }
68
85
  });
69
86
  const matchAliasPath = createAliasMatcher(baseUrl, alias);
70
- const matchTsPath = (0, _tsconfigPaths.createMatchPath)(baseUrl, tsPaths, ['main']);
87
+ const matchTsPath = (0, import_tsconfig_paths.createMatchPath)(baseUrl, tsPaths, ["main"]);
71
88
  const matchPath = (requestedModule, readJSONSync, fileExists, extensions) => {
72
- const result = matchTsPath(requestedModule, readJSONSync, fileExists, extensions);
89
+ const result = matchTsPath(
90
+ requestedModule,
91
+ readJSONSync,
92
+ fileExists,
93
+ extensions
94
+ );
73
95
  if (result) {
74
96
  return result;
75
97
  }
76
98
  return matchAliasPath(requestedModule);
77
99
  };
78
100
  if (Object.keys(paths).length === 0) {
79
- return undefined;
101
+ return void 0;
80
102
  }
81
- return ctx => {
82
- return sf => {
83
- const visitNode = node => {
103
+ return (ctx) => {
104
+ return (sf) => {
105
+ const visitNode = (node) => {
106
+ var _a;
84
107
  if (isDynamicImport(tsBinary, node)) {
85
108
  const importPathWithQuotes = node.arguments[0].getText(sf);
86
- const text = importPathWithQuotes.slice(1, importPathWithQuotes.length - 1);
109
+ const text = importPathWithQuotes.slice(
110
+ 1,
111
+ importPathWithQuotes.length - 1
112
+ );
87
113
  const result = getNotAliasedPath(sf, matchPath, text);
88
114
  if (!result) {
89
115
  return node;
90
116
  }
91
- return tsBinary.factory.updateCallExpression(node, node.expression, node.typeArguments, tsBinary.factory.createNodeArray([tsBinary.factory.createStringLiteral(result)]));
117
+ return tsBinary.factory.updateCallExpression(
118
+ node,
119
+ node.expression,
120
+ node.typeArguments,
121
+ tsBinary.factory.createNodeArray([
122
+ tsBinary.factory.createStringLiteral(result)
123
+ ])
124
+ );
92
125
  }
93
126
  if (tsBinary.isImportDeclaration(node) || tsBinary.isExportDeclaration(node) && node.moduleSpecifier) {
94
127
  try {
95
- var _node$moduleSpecifier;
96
- const importPathWithQuotes = node === null || node === void 0 ? void 0 : (_node$moduleSpecifier = node.moduleSpecifier) === null || _node$moduleSpecifier === void 0 ? void 0 : _node$moduleSpecifier.getText();
128
+ const importPathWithQuotes = (_a = node == null ? void 0 : node.moduleSpecifier) == null ? void 0 : _a.getText();
97
129
  if (!importPathWithQuotes) {
98
130
  return node;
99
131
  }
100
- const text = importPathWithQuotes.substring(1, importPathWithQuotes.length - 1);
132
+ const text = importPathWithQuotes.substring(
133
+ 1,
134
+ importPathWithQuotes.length - 1
135
+ );
101
136
  const result = getNotAliasedPath(sf, matchPath, text);
102
137
  if (!result) {
103
138
  return node;
@@ -106,13 +141,28 @@ function tsconfigPathsBeforeHookFactory(tsBinary, baseUrl, paths) {
106
141
  moduleSpecifier.parent = node.moduleSpecifier.parent;
107
142
  let newNode;
108
143
  if (tsBinary.isImportDeclaration(node)) {
109
- newNode = tsBinary.factory.updateImportDeclaration(node, node.decorators, node.modifiers, node.importClause, moduleSpecifier, node.assertClause);
144
+ newNode = tsBinary.factory.updateImportDeclaration(
145
+ node,
146
+ node.decorators,
147
+ node.modifiers,
148
+ node.importClause,
149
+ moduleSpecifier,
150
+ node.assertClause
151
+ );
110
152
  } else {
111
- newNode = tsBinary.factory.updateExportDeclaration(node, node.decorators, node.modifiers, node.isTypeOnly, node.exportClause, moduleSpecifier, node.assertClause);
153
+ newNode = tsBinary.factory.updateExportDeclaration(
154
+ node,
155
+ node.decorators,
156
+ node.modifiers,
157
+ node.isTypeOnly,
158
+ node.exportClause,
159
+ moduleSpecifier,
160
+ node.assertClause
161
+ );
112
162
  }
113
163
  newNode.flags = node.flags;
114
164
  return newNode;
115
- } catch (_unused) {
165
+ } catch (e) {
116
166
  return node;
117
167
  }
118
168
  }
@@ -122,44 +172,45 @@ function tsconfigPathsBeforeHookFactory(tsBinary, baseUrl, paths) {
122
172
  };
123
173
  };
124
174
  }
125
-
126
- // fork from https://github.com/nestjs/nest-cli/blob/HEAD/lib/compiler/hooks/tsconfig-paths.hook.ts
127
175
  function getNotAliasedPath(sf, matcher, text) {
128
- let result = matcher(text, undefined, undefined, ['.ts', '.tsx', '.js', '.jsx']);
176
+ let result = matcher(text, void 0, void 0, [
177
+ ".ts",
178
+ ".tsx",
179
+ ".js",
180
+ ".jsx"
181
+ ]);
129
182
  if (!result) {
130
183
  return;
131
184
  }
132
- if (os.platform() === 'win32') {
133
- result = result.replace(/\\/g, '/');
185
+ if (os.platform() === "win32") {
186
+ result = result.replace(/\\/g, "/");
134
187
  }
135
- if (!_path.default.isAbsolute(result)) {
136
- // handle alias to alias
137
- if (!result.startsWith('.') && !result.startsWith('..')) {
188
+ if (!import_path.default.isAbsolute(result)) {
189
+ if (!result.startsWith(".") && !result.startsWith("..")) {
138
190
  try {
139
- // Installed packages (node modules) should take precedence over root files with the same name.
140
- // Ref: https://github.com/nestjs/nest-cli/issues/838
141
191
  const packagePath = require.resolve(result, {
142
192
  paths: [process.cwd(), ...module.paths]
143
193
  });
144
194
  if (packagePath) {
145
- // eslint-disable-next-line consistent-return
146
195
  return result;
147
196
  }
148
- } catch (_unused2) {}
197
+ } catch (e) {
198
+ }
149
199
  }
150
200
  try {
151
- // Installed packages (node modules) should take precedence over root files with the same name.
152
- // Ref: https://github.com/nestjs/nest-cli/issues/838
153
201
  const packagePath = require.resolve(text, {
154
202
  paths: [process.cwd(), ...module.paths]
155
203
  });
156
204
  if (packagePath) {
157
- // eslint-disable-next-line consistent-return
158
205
  return text;
159
206
  }
160
- } catch (_unused3) {}
207
+ } catch (e) {
208
+ }
161
209
  }
162
- const resolvedPath = _path.posix.relative((0, _path.dirname)(sf.fileName), result) || './';
163
- // eslint-disable-next-line consistent-return
164
- return resolvedPath[0] === '.' ? resolvedPath : `./${resolvedPath}`;
165
- }
210
+ const resolvedPath = import_path.posix.relative((0, import_path.dirname)(sf.fileName), result) || "./";
211
+ return resolvedPath[0] === "." ? resolvedPath : `./${resolvedPath}`;
212
+ }
213
+ // Annotate the CommonJS export names for ESM import in node:
214
+ 0 && (module.exports = {
215
+ tsconfigPathsBeforeHookFactory
216
+ });
@@ -1,16 +1,27 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
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 typescript_loader_exports = {};
19
+ __export(typescript_loader_exports, {
20
+ TypescriptLoader: () => TypescriptLoader
5
21
  });
6
- exports.TypescriptLoader = void 0;
7
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
22
+ module.exports = __toCommonJS(typescript_loader_exports);
8
23
  class TypescriptLoader {
9
- constructor({
10
- appDirectory
11
- }) {
12
- _defineProperty(this, "tsBinary", void 0);
13
- _defineProperty(this, "appDirectory", void 0);
24
+ constructor({ appDirectory }) {
14
25
  this.appDirectory = appDirectory;
15
26
  }
16
27
  load() {
@@ -18,14 +29,19 @@ class TypescriptLoader {
18
29
  return this.tsBinary;
19
30
  }
20
31
  try {
21
- const tsPath = require.resolve('typescript', {
32
+ const tsPath = require.resolve("typescript", {
22
33
  paths: [this.appDirectory || process.cwd()]
23
34
  });
24
35
  const ts = require(tsPath);
25
36
  return ts;
26
37
  } catch (error) {
27
- throw new Error('TypeScript could not be found! Please, install "typescript" package.');
38
+ throw new Error(
39
+ 'TypeScript could not be found! Please, install "typescript" package.'
40
+ );
28
41
  }
29
42
  }
30
43
  }
31
- exports.TypescriptLoader = TypescriptLoader;
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ TypescriptLoader
47
+ });
@@ -1,27 +1,29 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _exportNames = {
7
- compile: true
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
8
  };
9
- Object.defineProperty(exports, "compile", {
10
- enumerable: true,
11
- get: function () {
12
- return _common.compile;
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 });
13
14
  }
15
+ return to;
16
+ };
17
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var src_exports = {};
20
+ __export(src_exports, {
21
+ compile: () => import_common.compile
14
22
  });
15
- var _babel = require("./compilers/babel");
16
- Object.keys(_babel).forEach(function (key) {
17
- if (key === "default" || key === "__esModule") return;
18
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
19
- if (key in exports && exports[key] === _babel[key]) return;
20
- Object.defineProperty(exports, key, {
21
- enumerable: true,
22
- get: function () {
23
- return _babel[key];
24
- }
25
- });
23
+ module.exports = __toCommonJS(src_exports);
24
+ __reExport(src_exports, require("./compilers/babel"), module.exports);
25
+ var import_common = require("./common");
26
+ // Annotate the CommonJS export names for ESM import in node:
27
+ 0 && (module.exports = {
28
+ compile
26
29
  });
27
- var _common = require("./common");