@modern-js/server-utils 2.0.0-beta.3 → 2.0.0-beta.4
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 +54 -0
- package/dist/js/modern/common/index.js +42 -17
- package/dist/js/modern/compilers/babel/index.js +124 -78
- package/dist/js/modern/compilers/typescript/index.js +87 -61
- package/dist/js/modern/compilers/typescript/tsconfig-paths-plugin.js +77 -47
- package/dist/js/modern/compilers/typescript/typescript-loader.js +10 -10
- package/dist/js/modern/index.js +4 -1
- package/dist/js/node/common/index.js +68 -28
- package/dist/js/node/compilers/babel/index.js +146 -108
- package/dist/js/node/compilers/typescript/index.js +118 -75
- package/dist/js/node/compilers/typescript/tsconfig-paths-plugin.js +102 -55
- package/dist/js/node/compilers/typescript/typescript-loader.js +26 -14
- package/dist/js/node/index.js +22 -24
- package/dist/js/treeshaking/common/index.js +199 -60
- package/dist/js/treeshaking/compilers/babel/index.js +362 -140
- package/dist/js/treeshaking/compilers/typescript/index.js +332 -149
- package/dist/js/treeshaking/compilers/typescript/tsconfig-paths-plugin.js +229 -154
- package/dist/js/treeshaking/compilers/typescript/typescript-loader.js +63 -28
- package/dist/js/treeshaking/index.js +2 -1
- package/package.json +8 -9
|
@@ -1,171 +1,246 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
return filePath;
|
|
17
|
-
};
|
|
18
|
-
var createAliasMatcher = function createAliasMatcher(baseUrl, alias) {
|
|
19
|
-
var aliasPairs = Object.keys(alias).reduce(function (o, key) {
|
|
20
|
-
if (isRegExpKey(key)) {
|
|
21
|
-
var regexp = new RegExp(key);
|
|
22
|
-
var aliasPath = resolveAliasPath(baseUrl, alias[key]);
|
|
23
|
-
o.push([regexp, aliasPath]);
|
|
1
|
+
function _arrayLikeToArray(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _arrayWithHoles(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return arr;
|
|
8
|
+
}
|
|
9
|
+
function _arrayWithoutHoles(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
11
|
+
}
|
|
12
|
+
function _instanceof(left, right) {
|
|
13
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
14
|
+
return !!right[Symbol.hasInstance](left);
|
|
24
15
|
} else {
|
|
25
|
-
|
|
26
|
-
o.push([key, _aliasPath]);
|
|
16
|
+
return left instanceof right;
|
|
27
17
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var
|
|
38
|
-
|
|
18
|
+
}
|
|
19
|
+
function _iterableToArray(iter) {
|
|
20
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
21
|
+
}
|
|
22
|
+
function _iterableToArrayLimit(arr, i) {
|
|
23
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
24
|
+
if (_i == null) return;
|
|
25
|
+
var _arr = [];
|
|
26
|
+
var _n = true;
|
|
27
|
+
var _d = false;
|
|
28
|
+
var _s, _e;
|
|
39
29
|
try {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
value = _step$value[1];
|
|
44
|
-
if (key instanceof RegExp) {
|
|
45
|
-
if (key.test(requestedModule)) {
|
|
46
|
-
cacheMap.set(requestedModule, value);
|
|
47
|
-
return value;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (requestedModule === key) {
|
|
51
|
-
cacheMap.set(requestedModule, value);
|
|
52
|
-
return value;
|
|
30
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
31
|
+
_arr.push(_s.value);
|
|
32
|
+
if (i && _arr.length === i) break;
|
|
53
33
|
}
|
|
54
|
-
}
|
|
55
34
|
} catch (err) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
35
|
+
_d = true;
|
|
36
|
+
_e = err;
|
|
37
|
+
} finally{
|
|
38
|
+
try {
|
|
39
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
40
|
+
} finally{
|
|
41
|
+
if (_d) throw _e;
|
|
42
|
+
}
|
|
59
43
|
}
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
return _arr;
|
|
45
|
+
}
|
|
46
|
+
function _nonIterableRest() {
|
|
47
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
48
|
+
}
|
|
49
|
+
function _nonIterableSpread() {
|
|
50
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
51
|
+
}
|
|
52
|
+
function _slicedToArray(arr, i) {
|
|
53
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
54
|
+
}
|
|
55
|
+
function _toConsumableArray(arr) {
|
|
56
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
57
|
+
}
|
|
58
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
59
|
+
if (!o) return;
|
|
60
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
61
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
62
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
63
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
64
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
65
|
+
}
|
|
66
|
+
import * as os from "os";
|
|
67
|
+
import path, { dirname, posix } from "path";
|
|
68
|
+
import * as ts from "typescript";
|
|
69
|
+
import { createMatchPath } from "@modern-js/utils/tsconfig-paths";
|
|
70
|
+
var isRegExpKey = function(str) {
|
|
71
|
+
return str.startsWith("^") || str.endsWith("$");
|
|
64
72
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
Object.keys(paths).forEach(function (key) {
|
|
69
|
-
if (Array.isArray(paths[key])) {
|
|
70
|
-
tsPaths[key] = paths[key];
|
|
71
|
-
} else {
|
|
72
|
-
alias[key] = paths[key];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
var matchAliasPath = createAliasMatcher(baseUrl, alias);
|
|
76
|
-
var matchTsPath = createMatchPath(baseUrl, tsPaths, ['main']);
|
|
77
|
-
var matchPath = function matchPath(requestedModule, readJSONSync, fileExists, extensions) {
|
|
78
|
-
var result = matchTsPath(requestedModule, readJSONSync, fileExists, extensions);
|
|
79
|
-
if (result) {
|
|
80
|
-
return result;
|
|
73
|
+
var resolveAliasPath = function(baseUrl, filePath) {
|
|
74
|
+
if (filePath.startsWith(".") || filePath.startsWith("..")) {
|
|
75
|
+
return path.resolve(baseUrl, filePath);
|
|
81
76
|
}
|
|
82
|
-
return
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
77
|
+
return filePath;
|
|
78
|
+
};
|
|
79
|
+
var createAliasMatcher = function(baseUrl, alias) {
|
|
80
|
+
var aliasPairs = Object.keys(alias).reduce(function(o, key) {
|
|
81
|
+
if (isRegExpKey(key)) {
|
|
82
|
+
var regexp = new RegExp(key);
|
|
83
|
+
var aliasPath = resolveAliasPath(baseUrl, alias[key]);
|
|
84
|
+
o.push([
|
|
85
|
+
regexp,
|
|
86
|
+
aliasPath
|
|
87
|
+
]);
|
|
88
|
+
} else {
|
|
89
|
+
var aliasPath1 = resolveAliasPath(baseUrl, alias[key]);
|
|
90
|
+
o.push([
|
|
91
|
+
key,
|
|
92
|
+
aliasPath1
|
|
93
|
+
]);
|
|
98
94
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
95
|
+
return o;
|
|
96
|
+
}, []);
|
|
97
|
+
var cacheMap = /* @__PURE__ */ new Map();
|
|
98
|
+
return function(requestedModule) {
|
|
99
|
+
if (cacheMap.has(requestedModule)) {
|
|
100
|
+
return cacheMap.get(requestedModule);
|
|
101
|
+
}
|
|
102
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
103
|
+
try {
|
|
104
|
+
for(var _iterator = aliasPairs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
105
|
+
var _value = _slicedToArray(_step.value, 2), key = _value[0], value = _value[1];
|
|
106
|
+
if (_instanceof(key, RegExp)) {
|
|
107
|
+
if (key.test(requestedModule)) {
|
|
108
|
+
cacheMap.set(requestedModule, value);
|
|
109
|
+
return value;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (requestedModule === key) {
|
|
113
|
+
cacheMap.set(requestedModule, value);
|
|
114
|
+
return value;
|
|
115
|
+
}
|
|
110
116
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
} catch (err) {
|
|
118
|
+
_didIteratorError = true;
|
|
119
|
+
_iteratorError = err;
|
|
120
|
+
} finally{
|
|
121
|
+
try {
|
|
122
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
123
|
+
_iterator.return();
|
|
124
|
+
}
|
|
125
|
+
} finally{
|
|
126
|
+
if (_didIteratorError) {
|
|
127
|
+
throw _iteratorError;
|
|
128
|
+
}
|
|
118
129
|
}
|
|
119
|
-
newNode.flags = node.flags;
|
|
120
|
-
return newNode;
|
|
121
|
-
} catch (_unused) {
|
|
122
|
-
return node;
|
|
123
|
-
}
|
|
124
130
|
}
|
|
125
|
-
return tsBinary.visitEachChild(node, visitNode, ctx);
|
|
126
|
-
};
|
|
127
|
-
return tsBinary.visitNode(sf, visitNode);
|
|
128
131
|
};
|
|
129
|
-
|
|
132
|
+
};
|
|
133
|
+
var isDynamicImport = function(tsBinary, node) {
|
|
134
|
+
return tsBinary.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword;
|
|
135
|
+
};
|
|
136
|
+
function tsconfigPathsBeforeHookFactory(tsBinary, baseUrl, paths) {
|
|
137
|
+
var tsPaths = {};
|
|
138
|
+
var alias = {};
|
|
139
|
+
Object.keys(paths).forEach(function(key) {
|
|
140
|
+
if (Array.isArray(paths[key])) {
|
|
141
|
+
tsPaths[key] = paths[key];
|
|
142
|
+
} else {
|
|
143
|
+
alias[key] = paths[key];
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
var matchAliasPath = createAliasMatcher(baseUrl, alias);
|
|
147
|
+
var matchTsPath = createMatchPath(baseUrl, tsPaths, [
|
|
148
|
+
"main"
|
|
149
|
+
]);
|
|
150
|
+
var matchPath = function(requestedModule, readJSONSync, fileExists, extensions) {
|
|
151
|
+
var result = matchTsPath(requestedModule, readJSONSync, fileExists, extensions);
|
|
152
|
+
if (result) {
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
return matchAliasPath(requestedModule);
|
|
156
|
+
};
|
|
157
|
+
if (Object.keys(paths).length === 0) {
|
|
158
|
+
return void 0;
|
|
159
|
+
}
|
|
160
|
+
return function(ctx) {
|
|
161
|
+
return function(sf) {
|
|
162
|
+
var visitNode = function(node) {
|
|
163
|
+
if (isDynamicImport(tsBinary, node)) {
|
|
164
|
+
var importPathWithQuotes = node.arguments[0].getText(sf);
|
|
165
|
+
var text = importPathWithQuotes.slice(1, importPathWithQuotes.length - 1);
|
|
166
|
+
var result = getNotAliasedPath(sf, matchPath, text);
|
|
167
|
+
if (!result) {
|
|
168
|
+
return node;
|
|
169
|
+
}
|
|
170
|
+
return tsBinary.factory.updateCallExpression(node, node.expression, node.typeArguments, tsBinary.factory.createNodeArray([
|
|
171
|
+
tsBinary.factory.createStringLiteral(result)
|
|
172
|
+
]));
|
|
173
|
+
}
|
|
174
|
+
if (tsBinary.isImportDeclaration(node) || tsBinary.isExportDeclaration(node) && node.moduleSpecifier) {
|
|
175
|
+
try {
|
|
176
|
+
var ref;
|
|
177
|
+
var importPathWithQuotes1 = node === null || node === void 0 ? void 0 : (ref = node.moduleSpecifier) === null || ref === void 0 ? void 0 : ref.getText();
|
|
178
|
+
if (!importPathWithQuotes1) {
|
|
179
|
+
return node;
|
|
180
|
+
}
|
|
181
|
+
var text1 = importPathWithQuotes1.substring(1, importPathWithQuotes1.length - 1);
|
|
182
|
+
var result1 = getNotAliasedPath(sf, matchPath, text1);
|
|
183
|
+
if (!result1) {
|
|
184
|
+
return node;
|
|
185
|
+
}
|
|
186
|
+
var moduleSpecifier = tsBinary.factory.createStringLiteral(result1);
|
|
187
|
+
moduleSpecifier.parent = node.moduleSpecifier.parent;
|
|
188
|
+
var newNode;
|
|
189
|
+
if (tsBinary.isImportDeclaration(node)) {
|
|
190
|
+
newNode = tsBinary.factory.updateImportDeclaration(node, node.decorators, node.modifiers, node.importClause, moduleSpecifier, node.assertClause);
|
|
191
|
+
} else {
|
|
192
|
+
newNode = tsBinary.factory.updateExportDeclaration(node, node.decorators, node.modifiers, node.isTypeOnly, node.exportClause, moduleSpecifier, node.assertClause);
|
|
193
|
+
}
|
|
194
|
+
newNode.flags = node.flags;
|
|
195
|
+
return newNode;
|
|
196
|
+
} catch (e) {
|
|
197
|
+
return node;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return tsBinary.visitEachChild(node, visitNode, ctx);
|
|
201
|
+
};
|
|
202
|
+
return tsBinary.visitNode(sf, visitNode);
|
|
203
|
+
};
|
|
204
|
+
};
|
|
130
205
|
}
|
|
131
|
-
|
|
132
|
-
// fork from https://github.com/nestjs/nest-cli/blob/HEAD/lib/compiler/hooks/tsconfig-paths.hook.ts
|
|
133
206
|
function getNotAliasedPath(sf, matcher, text) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
207
|
+
var result = matcher(text, void 0, void 0, [
|
|
208
|
+
".ts",
|
|
209
|
+
".tsx",
|
|
210
|
+
".js",
|
|
211
|
+
".jsx"
|
|
212
|
+
]);
|
|
213
|
+
if (!result) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
if (os.platform() === "win32") {
|
|
217
|
+
result = result.replace(/\\/g, "/");
|
|
218
|
+
}
|
|
219
|
+
if (!path.isAbsolute(result)) {
|
|
220
|
+
if (!result.startsWith(".") && !result.startsWith("..")) {
|
|
221
|
+
try {
|
|
222
|
+
var packagePath = require.resolve(result, {
|
|
223
|
+
paths: [
|
|
224
|
+
process.cwd()
|
|
225
|
+
].concat(_toConsumableArray(module.paths))
|
|
226
|
+
});
|
|
227
|
+
if (packagePath) {
|
|
228
|
+
return result;
|
|
229
|
+
}
|
|
230
|
+
} catch (e) {}
|
|
153
231
|
}
|
|
154
|
-
|
|
232
|
+
try {
|
|
233
|
+
var packagePath1 = require.resolve(text, {
|
|
234
|
+
paths: [
|
|
235
|
+
process.cwd()
|
|
236
|
+
].concat(_toConsumableArray(module.paths))
|
|
237
|
+
});
|
|
238
|
+
if (packagePath1) {
|
|
239
|
+
return text;
|
|
240
|
+
}
|
|
241
|
+
} catch (e1) {}
|
|
155
242
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
paths: [process.cwd()].concat(_toConsumableArray(module.paths))
|
|
161
|
-
});
|
|
162
|
-
if (_packagePath) {
|
|
163
|
-
// eslint-disable-next-line consistent-return
|
|
164
|
-
return text;
|
|
165
|
-
}
|
|
166
|
-
} catch (_unused3) {}
|
|
167
|
-
}
|
|
168
|
-
var resolvedPath = posix.relative(dirname(sf.fileName), result) || './';
|
|
169
|
-
// eslint-disable-next-line consistent-return
|
|
170
|
-
return resolvedPath[0] === '.' ? resolvedPath : "./".concat(resolvedPath);
|
|
171
|
-
}
|
|
243
|
+
var resolvedPath = posix.relative(dirname(sf.fileName), result) || "./";
|
|
244
|
+
return resolvedPath[0] === "." ? resolvedPath : "./".concat(resolvedPath);
|
|
245
|
+
}
|
|
246
|
+
export { tsconfigPathsBeforeHookFactory };
|
|
@@ -1,30 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
function _classCallCheck(instance, Constructor) {
|
|
2
|
+
if (!(instance instanceof Constructor)) {
|
|
3
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
function _defineProperties(target, props) {
|
|
7
|
+
for(var i = 0; i < props.length; i++){
|
|
8
|
+
var descriptor = props[i];
|
|
9
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
+
descriptor.configurable = true;
|
|
11
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
12
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
16
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
|
+
return Constructor;
|
|
19
|
+
}
|
|
20
|
+
function _defineProperty(obj, key, value) {
|
|
21
|
+
if (key in obj) {
|
|
22
|
+
Object.defineProperty(obj, key, {
|
|
23
|
+
value: value,
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true
|
|
21
27
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
} else {
|
|
29
|
+
obj[key] = value;
|
|
30
|
+
}
|
|
31
|
+
return obj;
|
|
32
|
+
}
|
|
33
|
+
var TypescriptLoader = /*#__PURE__*/ function() {
|
|
34
|
+
"use strict";
|
|
35
|
+
function TypescriptLoader(param) {
|
|
36
|
+
var appDirectory = param.appDirectory;
|
|
37
|
+
_classCallCheck(this, TypescriptLoader);
|
|
38
|
+
_defineProperty(this, "tsBinary", void 0);
|
|
39
|
+
_defineProperty(this, "appDirectory", void 0);
|
|
40
|
+
this.appDirectory = appDirectory;
|
|
27
41
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
42
|
+
_createClass(TypescriptLoader, [
|
|
43
|
+
{
|
|
44
|
+
key: "load",
|
|
45
|
+
value: function load() {
|
|
46
|
+
if (this.tsBinary) {
|
|
47
|
+
return this.tsBinary;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
var tsPath = require.resolve("typescript", {
|
|
51
|
+
paths: [
|
|
52
|
+
this.appDirectory || process.cwd()
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
var ts = require(tsPath);
|
|
56
|
+
return ts;
|
|
57
|
+
} catch (error) {
|
|
58
|
+
throw new Error('TypeScript could not be found! Please, install "typescript" package.');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
]);
|
|
63
|
+
return TypescriptLoader;
|
|
64
|
+
}();
|
|
65
|
+
export { TypescriptLoader };
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.0.0-beta.
|
|
14
|
+
"version": "2.0.0-beta.4",
|
|
15
15
|
"jsnext:source": "./src/index.ts",
|
|
16
16
|
"types": "./dist/types/index.d.ts",
|
|
17
17
|
"main": "./dist/js/node/index.js",
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@babel/compat-data": "^7.17.10",
|
|
32
31
|
"@babel/core": "^7.18.0",
|
|
33
32
|
"@babel/plugin-proposal-class-properties": "^7.17.12",
|
|
34
33
|
"@babel/plugin-proposal-decorators": "^7.18.0",
|
|
@@ -37,10 +36,10 @@
|
|
|
37
36
|
"@babel/runtime": "^7.18.0",
|
|
38
37
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
39
38
|
"babel-plugin-transform-typescript-metadata": "^0.3.2",
|
|
40
|
-
"@modern-js/babel-compiler": "2.0.0-beta.
|
|
41
|
-
"@modern-js/babel-preset-lib": "2.0.0-beta.
|
|
42
|
-
"@modern-js/plugin": "2.0.0-beta.
|
|
43
|
-
"@modern-js/utils": "2.0.0-beta.
|
|
39
|
+
"@modern-js/babel-compiler": "2.0.0-beta.4",
|
|
40
|
+
"@modern-js/babel-preset-lib": "2.0.0-beta.4",
|
|
41
|
+
"@modern-js/plugin": "2.0.0-beta.4",
|
|
42
|
+
"@modern-js/utils": "2.0.0-beta.4"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
46
45
|
"@types/babel__core": "^7.1.15",
|
|
@@ -49,9 +48,9 @@
|
|
|
49
48
|
"jest": "^27",
|
|
50
49
|
"ts-jest": "^27.0.4",
|
|
51
50
|
"typescript": "^4",
|
|
52
|
-
"@modern-js/server-core": "2.0.0-beta.
|
|
53
|
-
"@scripts/build": "2.0.0-beta.
|
|
54
|
-
"@scripts/jest-config": "2.0.0-beta.
|
|
51
|
+
"@modern-js/server-core": "2.0.0-beta.4",
|
|
52
|
+
"@scripts/build": "2.0.0-beta.4",
|
|
53
|
+
"@scripts/jest-config": "2.0.0-beta.4"
|
|
55
54
|
},
|
|
56
55
|
"sideEffects": false,
|
|
57
56
|
"publishConfig": {
|