ts-swc-transform 2.2.6 → 2.2.8

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,9 +1,9 @@
1
1
  // bail early
2
2
  var useCJS = !require('module').createRequire;
3
3
  if (useCJS) {
4
- module.exports.moduleResolve = function () { return null };
5
- module.exports.resolve = function () { return null };
6
- return;
4
+ module.exports.moduleResolve = function () { return null };
5
+ module.exports.resolve = function () { return null };
6
+ return;
7
7
  }
8
8
  'use strict';
9
9
 
@@ -26,8 +26,8 @@ var util = require('util');
26
26
  *
27
27
  * @typedef {Error & ErrnoExceptionFields} ErrnoException
28
28
  */ /**
29
- * @typedef {(...parameters: Array<any>) => string} MessageFunction
30
- */ // Manually “tree shaken” from:
29
+ * @typedef {(...parameters: Array<any>) => string} MessageFunction
30
+ */ // Manually “tree shaken” from:
31
31
  // <https://github.com/nodejs/node/blob/45f5c9b/lib/internal/errors.js>
32
32
  // Last checked on: Nov 2, 2023.
33
33
  function _type_of$1(obj) {
@@ -61,7 +61,7 @@ var codes = {};
61
61
  * The list type to be inserted before the last element.
62
62
  * @returns {string}
63
63
  */ function formatList(array) {
64
- var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'and';
64
+ var type = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'and';
65
65
  return array.length < 3 ? array.join(" ".concat(type, " ")) : "".concat(array.slice(0, -1).join(', '), ", ").concat(type, " ").concat(array[array.length - 1]);
66
66
  }
67
67
  /** @type {Map<string, MessageFunction | string>} */ var messages = new Map();
@@ -71,157 +71,157 @@ codes.ERR_INVALID_ARG_TYPE = createError('ERR_INVALID_ARG_TYPE', /**
71
71
  * @param {string} name
72
72
  * @param {Array<string> | string} expected
73
73
  * @param {unknown} actual
74
- */ function (name, expected, actual) {
75
- assert(typeof name === 'string', "'name' must be a string");
76
- if (!Array.isArray(expected)) {
77
- expected = [
78
- expected
79
- ];
80
- }
81
- var message = 'The ';
82
- if (name.endsWith(' argument')) {
83
- // For cases like 'first argument'
84
- message += "".concat(name, " ");
85
- } else {
86
- var type = name.includes('.') ? 'property' : 'argument';
87
- message += '"'.concat(name, '" ').concat(type, " ");
88
- }
89
- message += 'must be ';
74
+ */ function(name, expected, actual) {
75
+ assert(typeof name === 'string', "'name' must be a string");
76
+ if (!Array.isArray(expected)) {
77
+ expected = [
78
+ expected
79
+ ];
80
+ }
81
+ var message = 'The ';
82
+ if (name.endsWith(' argument')) {
83
+ // For cases like 'first argument'
84
+ message += "".concat(name, " ");
85
+ } else {
86
+ var type = name.includes('.') ? 'property' : 'argument';
87
+ message += '"'.concat(name, '" ').concat(type, " ");
88
+ }
89
+ message += 'must be ';
90
90
  /** @type {Array<string>} */ var types = [];
91
91
  /** @type {Array<string>} */ var instances = [];
92
92
  /** @type {Array<string>} */ var other = [];
93
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
94
- try {
95
- for (var _iterator = expected[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
96
- var value = _step.value;
97
- assert(typeof value === 'string', 'All expected entries have to be of type string');
98
- if (kTypes.has(value)) {
99
- types.push(value.toLowerCase());
100
- } else if (classRegExp.exec(value) === null) {
101
- assert(value !== 'object', 'The value "object" should be written as "Object"');
102
- other.push(value);
103
- } else {
104
- instances.push(value);
105
- }
106
- }
107
- } catch (err) {
108
- _didIteratorError = true;
109
- _iteratorError = err;
110
- } finally {
111
- try {
112
- if (!_iteratorNormalCompletion && _iterator.return != null) {
113
- _iterator.return();
114
- }
115
- } finally {
116
- if (_didIteratorError) {
117
- throw _iteratorError;
118
- }
93
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
94
+ try {
95
+ for(var _iterator = expected[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
96
+ var value = _step.value;
97
+ assert(typeof value === 'string', 'All expected entries have to be of type string');
98
+ if (kTypes.has(value)) {
99
+ types.push(value.toLowerCase());
100
+ } else if (classRegExp.exec(value) === null) {
101
+ assert(value !== 'object', 'The value "object" should be written as "Object"');
102
+ other.push(value);
103
+ } else {
104
+ instances.push(value);
119
105
  }
120
106
  }
121
- // Special handle `object` in case other instances are allowed to outline
122
- // the differences between each other.
123
- if (instances.length > 0) {
124
- var pos = types.indexOf('object');
125
- if (pos !== -1) {
126
- types.slice(pos, 1);
127
- instances.push('Object');
107
+ } catch (err) {
108
+ _didIteratorError = true;
109
+ _iteratorError = err;
110
+ } finally{
111
+ try {
112
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
113
+ _iterator.return();
114
+ }
115
+ } finally{
116
+ if (_didIteratorError) {
117
+ throw _iteratorError;
128
118
  }
129
119
  }
130
- if (types.length > 0) {
131
- message += "".concat(types.length > 1 ? 'one of type' : 'of type', " ").concat(formatList(types, 'or'));
132
- if (instances.length > 0 || other.length > 0) message += ' or ';
133
- }
134
- if (instances.length > 0) {
135
- message += "an instance of ".concat(formatList(instances, 'or'));
136
- if (other.length > 0) message += ' or ';
120
+ }
121
+ // Special handle `object` in case other instances are allowed to outline
122
+ // the differences between each other.
123
+ if (instances.length > 0) {
124
+ var pos = types.indexOf('object');
125
+ if (pos !== -1) {
126
+ types.slice(pos, 1);
127
+ instances.push('Object');
137
128
  }
138
- if (other.length > 0) {
139
- if (other.length > 1) {
140
- message += "one of ".concat(formatList(other, 'or'));
141
- } else {
142
- if (other[0].toLowerCase() !== other[0]) message += 'an ';
143
- message += "".concat(other[0]);
144
- }
129
+ }
130
+ if (types.length > 0) {
131
+ message += "".concat(types.length > 1 ? 'one of type' : 'of type', " ").concat(formatList(types, 'or'));
132
+ if (instances.length > 0 || other.length > 0) message += ' or ';
133
+ }
134
+ if (instances.length > 0) {
135
+ message += "an instance of ".concat(formatList(instances, 'or'));
136
+ if (other.length > 0) message += ' or ';
137
+ }
138
+ if (other.length > 0) {
139
+ if (other.length > 1) {
140
+ message += "one of ".concat(formatList(other, 'or'));
141
+ } else {
142
+ if (other[0].toLowerCase() !== other[0]) message += 'an ';
143
+ message += "".concat(other[0]);
145
144
  }
146
- message += ". Received ".concat(determineSpecificType(actual));
147
- return message;
148
- }, TypeError);
145
+ }
146
+ message += ". Received ".concat(determineSpecificType(actual));
147
+ return message;
148
+ }, TypeError);
149
149
  codes.ERR_INVALID_MODULE_SPECIFIER = createError('ERR_INVALID_MODULE_SPECIFIER', /**
150
150
  * @param {string} request
151
151
  * @param {string} reason
152
152
  * @param {string} [base]
153
- */ function (request, reason) {
154
- var base = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
155
- return 'Invalid module "'.concat(request, '" ').concat(reason).concat(base ? " imported from ".concat(base) : '');
156
- }, TypeError);
153
+ */ function(request, reason) {
154
+ var base = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : undefined;
155
+ return 'Invalid module "'.concat(request, '" ').concat(reason).concat(base ? " imported from ".concat(base) : '');
156
+ }, TypeError);
157
157
  codes.ERR_INVALID_PACKAGE_CONFIG = createError('ERR_INVALID_PACKAGE_CONFIG', /**
158
158
  * @param {string} path
159
159
  * @param {string} [base]
160
160
  * @param {string} [message]
161
- */ function (path, base, message) {
162
- return "Invalid package config ".concat(path).concat(base ? " while importing ".concat(base) : '').concat(message ? ". ".concat(message) : '');
163
- }, Error);
161
+ */ function(path, base, message) {
162
+ return "Invalid package config ".concat(path).concat(base ? " while importing ".concat(base) : '').concat(message ? ". ".concat(message) : '');
163
+ }, Error);
164
164
  codes.ERR_INVALID_PACKAGE_TARGET = createError('ERR_INVALID_PACKAGE_TARGET', /**
165
165
  * @param {string} packagePath
166
166
  * @param {string} key
167
167
  * @param {unknown} target
168
168
  * @param {boolean} [isImport=false]
169
169
  * @param {string} [base]
170
- */ function (packagePath, key, target) {
171
- var isImport = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false, base = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : undefined;
172
- var relatedError = typeof target === 'string' && !isImport && target.length > 0 && !target.startsWith('./');
173
- if (key === '.') {
174
- assert(isImport === false);
175
- return 'Invalid "exports" main target '.concat(JSON.stringify(target), " defined ") + "in the package config ".concat(packagePath, "package.json").concat(base ? " imported from ".concat(base) : '').concat(relatedError ? '; targets must start with "./"' : '');
176
- }
177
- return 'Invalid "'.concat(isImport ? 'imports' : 'exports', '" target ').concat(JSON.stringify(target), " defined for '").concat(key, "' in the package config ").concat(packagePath, "package.json").concat(base ? " imported from ".concat(base) : '').concat(relatedError ? '; targets must start with "./"' : '');
178
- }, Error);
170
+ */ function(packagePath, key, target) {
171
+ var isImport = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, base = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : undefined;
172
+ var relatedError = typeof target === 'string' && !isImport && target.length > 0 && !target.startsWith('./');
173
+ if (key === '.') {
174
+ assert(isImport === false);
175
+ return 'Invalid "exports" main target '.concat(JSON.stringify(target), " defined ") + "in the package config ".concat(packagePath, "package.json").concat(base ? " imported from ".concat(base) : '').concat(relatedError ? '; targets must start with "./"' : '');
176
+ }
177
+ return 'Invalid "'.concat(isImport ? 'imports' : 'exports', '" target ').concat(JSON.stringify(target), " defined for '").concat(key, "' in the package config ").concat(packagePath, "package.json").concat(base ? " imported from ".concat(base) : '').concat(relatedError ? '; targets must start with "./"' : '');
178
+ }, Error);
179
179
  codes.ERR_MODULE_NOT_FOUND = createError('ERR_MODULE_NOT_FOUND', /**
180
180
  * @param {string} path
181
181
  * @param {string} base
182
182
  * @param {boolean} [exactUrl]
183
- */ function (path, base) {
184
- var exactUrl = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
185
- return "Cannot find ".concat(exactUrl ? 'module' : 'package', " '").concat(path, "' imported from ").concat(base);
186
- }, Error);
183
+ */ function(path, base) {
184
+ var exactUrl = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
185
+ return "Cannot find ".concat(exactUrl ? 'module' : 'package', " '").concat(path, "' imported from ").concat(base);
186
+ }, Error);
187
187
  codes.ERR_NETWORK_IMPORT_DISALLOWED = createError('ERR_NETWORK_IMPORT_DISALLOWED', "import of '%s' by %s is not supported: %s", Error);
188
188
  codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError('ERR_PACKAGE_IMPORT_NOT_DEFINED', /**
189
189
  * @param {string} specifier
190
190
  * @param {string} packagePath
191
191
  * @param {string} base
192
- */ function (specifier, packagePath, base) {
193
- return 'Package import specifier "'.concat(specifier, '" is not defined').concat(packagePath ? " in package ".concat(packagePath, "package.json") : '', " imported from ").concat(base);
194
- }, TypeError);
192
+ */ function(specifier, packagePath, base) {
193
+ return 'Package import specifier "'.concat(specifier, '" is not defined').concat(packagePath ? " in package ".concat(packagePath, "package.json") : '', " imported from ").concat(base);
194
+ }, TypeError);
195
195
  codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError('ERR_PACKAGE_PATH_NOT_EXPORTED', /**
196
196
  * @param {string} packagePath
197
197
  * @param {string} subpath
198
198
  * @param {string} [base]
199
- */ function (packagePath, subpath) {
200
- var base = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
201
- if (subpath === '.') return 'No "exports" main defined in '.concat(packagePath, "package.json").concat(base ? " imported from ".concat(base) : '');
202
- return "Package subpath '".concat(subpath, '\' is not defined by "exports" in ').concat(packagePath, "package.json").concat(base ? " imported from ".concat(base) : '');
203
- }, Error);
199
+ */ function(packagePath, subpath) {
200
+ var base = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : undefined;
201
+ if (subpath === '.') return 'No "exports" main defined in '.concat(packagePath, "package.json").concat(base ? " imported from ".concat(base) : '');
202
+ return "Package subpath '".concat(subpath, '\' is not defined by "exports" in ').concat(packagePath, "package.json").concat(base ? " imported from ".concat(base) : '');
203
+ }, Error);
204
204
  codes.ERR_UNSUPPORTED_DIR_IMPORT = createError('ERR_UNSUPPORTED_DIR_IMPORT', "Directory import '%s' is not supported " + 'resolving ES modules imported from %s', Error);
205
205
  codes.ERR_UNSUPPORTED_RESOLVE_REQUEST = createError('ERR_UNSUPPORTED_RESOLVE_REQUEST', 'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.', TypeError);
206
206
  codes.ERR_UNKNOWN_FILE_EXTENSION = createError('ERR_UNKNOWN_FILE_EXTENSION', /**
207
207
  * @param {string} extension
208
208
  * @param {string} path
209
- */ function (extension, path) {
210
- return 'Unknown file extension "'.concat(extension, '" for ').concat(path);
211
- }, TypeError);
209
+ */ function(extension, path) {
210
+ return 'Unknown file extension "'.concat(extension, '" for ').concat(path);
211
+ }, TypeError);
212
212
  codes.ERR_INVALID_ARG_VALUE = createError('ERR_INVALID_ARG_VALUE', /**
213
213
  * @param {string} name
214
214
  * @param {unknown} value
215
215
  * @param {string} [reason='is invalid']
216
- */ function (name, value) {
217
- var reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'is invalid';
218
- var inspected = util.inspect(value);
219
- if (inspected.length > 128) {
220
- inspected = "".concat(inspected.slice(0, 128), "...");
221
- }
222
- var type = name.includes('.') ? 'property' : 'argument';
223
- return "The ".concat(type, " '").concat(name, "' ").concat(reason, ". Received ").concat(inspected);
224
- }, TypeError);
216
+ */ function(name, value) {
217
+ var reason = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 'is invalid';
218
+ var inspected = util.inspect(value);
219
+ if (inspected.length > 128) {
220
+ inspected = "".concat(inspected.slice(0, 128), "...");
221
+ }
222
+ var type = name.includes('.') ? 'property' : 'argument';
223
+ return "The ".concat(type, " '").concat(name, "' ").concat(reason, ". Received ").concat(inspected);
224
+ }, TypeError);
225
225
  /**
226
226
  * Utility function for registering the error codes. Only used here. Exported
227
227
  * *only* to allow for testing.
@@ -245,7 +245,7 @@ codes.ERR_INVALID_ARG_VALUE = createError('ERR_INVALID_ARG_VALUE', /**
245
245
  /**
246
246
  * @param {Array<unknown>} parameters
247
247
  */ function NodeError() {
248
- for (var _len = arguments.length, parameters = new Array(_len), _key = 0; _key < _len; _key++) {
248
+ for(var _len = arguments.length, parameters = new Array(_len), _key = 0; _key < _len; _key++){
249
249
  parameters[_key] = arguments[_key];
250
250
  }
251
251
  var limit = Error.stackTraceLimit;
@@ -287,7 +287,7 @@ codes.ERR_INVALID_ARG_VALUE = createError('ERR_INVALID_ARG_VALUE', /**
287
287
  if (v8.startupSnapshot.isBuildingSnapshot()) {
288
288
  return false;
289
289
  }
290
- } catch (e) { }
290
+ } catch (e) {}
291
291
  var desc = Object.getOwnPropertyDescriptor(Error, 'stackTraceLimit');
292
292
  if (desc === undefined) {
293
293
  return Object.isExtensible(Error);
@@ -312,17 +312,17 @@ var captureLargerStackTrace = hideStackFrames(/**
312
312
  * @param {Error} error
313
313
  * @returns {Error}
314
314
  */ // @ts-expect-error: fine
315
- function (error) {
316
- var stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
317
- if (stackTraceLimitIsWritable) {
318
- userStackTraceLimit = Error.stackTraceLimit;
319
- Error.stackTraceLimit = Number.POSITIVE_INFINITY;
320
- }
321
- Error.captureStackTrace(error);
322
- // Reset the limit
323
- if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
324
- return error;
325
- });
315
+ function(error) {
316
+ var stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
317
+ if (stackTraceLimitIsWritable) {
318
+ userStackTraceLimit = Error.stackTraceLimit;
319
+ Error.stackTraceLimit = Number.POSITIVE_INFINITY;
320
+ }
321
+ Error.captureStackTrace(error);
322
+ // Reset the limit
323
+ if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
324
+ return error;
325
+ });
326
326
  /**
327
327
  * @param {string} key
328
328
  * @param {Array<unknown>} parameters
@@ -337,7 +337,7 @@ var captureLargerStackTrace = hideStackFrames(/**
337
337
  }
338
338
  var regex = /%[dfijoOs]/g;
339
339
  var expectedLength = 0;
340
- while (regex.exec(message) !== null) expectedLength++;
340
+ while(regex.exec(message) !== null)expectedLength++;
341
341
  assert(expectedLength === parameters.length, "Code: ".concat(key, "; The provided arguments length (").concat(parameters.length, ") does not ") + "match the required ones (".concat(expectedLength, ")."));
342
342
  if (parameters.length === 0) return message;
343
343
  parameters.unshift(message);
@@ -446,7 +446,7 @@ var ERR_INVALID_PACKAGE_CONFIG$1 = codes.ERR_INVALID_PACKAGE_CONFIG;
446
446
  */ function getPackageScopeConfig(resolved) {
447
447
  // Note: in Node, this is now a native module.
448
448
  var packageJSONUrl = new URL('package.json', resolved);
449
- while (true) {
449
+ while(true){
450
450
  var packageJSONPath = packageJSONUrl.pathname;
451
451
  if (packageJSONPath.endsWith('node_modules/package.json')) {
452
452
  break;
@@ -518,7 +518,7 @@ var hasOwnProperty = {}.hasOwnProperty;
518
518
  'file:': getFileProtocolModuleFormat,
519
519
  'http:': getHttpProtocolModuleFormat,
520
520
  'https:': getHttpProtocolModuleFormat,
521
- 'node:': function () {
521
+ 'node:': function() {
522
522
  return 'builtin';
523
523
  }
524
524
  };
@@ -544,13 +544,13 @@ var hasOwnProperty = {}.hasOwnProperty;
544
544
  */ function extname(url) {
545
545
  var pathname = url.pathname;
546
546
  var index = pathname.length;
547
- while (index--) {
547
+ while(index--){
548
548
  var code = pathname.codePointAt(index);
549
- if (code === 47 /* `/` */) {
549
+ if (code === 47 /* `/` */ ) {
550
550
  return '';
551
551
  }
552
- if (code === 46 /* `.` */) {
553
- return pathname.codePointAt(index - 1) === 47 /* `/` */ ? '' : pathname.slice(index);
552
+ if (code === 46 /* `.` */ ) {
553
+ return pathname.codePointAt(index - 1) === 47 /* `/` */ ? '' : pathname.slice(index);
554
554
  }
555
555
  }
556
556
  return '';
@@ -586,7 +586,7 @@ var hasOwnProperty = {}.hasOwnProperty;
586
586
  throw new ERR_UNKNOWN_FILE_EXTENSION(value, filepath);
587
587
  }
588
588
  function getHttpProtocolModuleFormat() {
589
- // To do: HTTPS imports.
589
+ // To do: HTTPS imports.
590
590
  }
591
591
  /**
592
592
  * @param {URL} url
@@ -706,10 +706,10 @@ var doubleSlashRegEx = /[/\\]{2}/;
706
706
  try {
707
707
  return fs.statSync(path);
708
708
  } catch (e) {
709
- // Note: in Node code this returns `new Stats`,
710
- // but in Node 22 that’s marked as a deprecated internal API.
711
- // Which, well, we kinda are, but still to prevent that warning,
712
- // just yield `undefined`.
709
+ // Note: in Node code this returns `new Stats`,
710
+ // but in Node 22 that’s marked as a deprecated internal API.
711
+ // Which, well, we kinda are, but still to prevent that warning,
712
+ // just yield `undefined`.
713
713
  }
714
714
  }
715
715
  /**
@@ -749,7 +749,7 @@ var doubleSlashRegEx = /[/\\]{2}/;
749
749
  "./".concat(packageConfig.main, "/index.node")
750
750
  ];
751
751
  var i = -1;
752
- while (++i < tries.length) {
752
+ while(++i < tries.length){
753
753
  guess = new url.URL(tries[i], packageJsonUrl);
754
754
  if (fileExists(guess)) break;
755
755
  guess = undefined;
@@ -758,7 +758,7 @@ var doubleSlashRegEx = /[/\\]{2}/;
758
758
  emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main);
759
759
  return guess;
760
760
  }
761
- // Fallthrough.
761
+ // Fallthrough.
762
762
  }
763
763
  var tries1 = [
764
764
  './index.js',
@@ -766,7 +766,7 @@ var doubleSlashRegEx = /[/\\]{2}/;
766
766
  './index.node'
767
767
  ];
768
768
  var i1 = -1;
769
- while (++i1 < tries1.length) {
769
+ while(++i1 < tries1.length){
770
770
  guess = new url.URL(tries1[i1], packageJsonUrl);
771
771
  if (fileExists(guess)) break;
772
772
  guess = undefined;
@@ -880,10 +880,10 @@ var doubleSlashRegEx = /[/\\]{2}/;
880
880
  new url.URL(target);
881
881
  isURL = true;
882
882
  } catch (e) {
883
- // Continue regardless of error.
883
+ // Continue regardless of error.
884
884
  }
885
885
  if (!isURL) {
886
- var exportTarget = pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, function () {
886
+ var exportTarget = pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, function() {
887
887
  return subpath;
888
888
  }) : target + subpath;
889
889
  return packageResolve(exportTarget, packageJsonUrl, conditions);
@@ -894,10 +894,10 @@ var doubleSlashRegEx = /[/\\]{2}/;
894
894
  if (invalidSegmentRegEx.exec(target.slice(2)) !== null) {
895
895
  if (deprecatedInvalidSegmentRegEx.exec(target.slice(2)) === null) {
896
896
  if (!isPathMap) {
897
- var request = pattern ? match.replace('*', function () {
897
+ var request = pattern ? match.replace('*', function() {
898
898
  return subpath;
899
899
  }) : match + subpath;
900
- var resolvedTarget = pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, function () {
900
+ var resolvedTarget = pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, function() {
901
901
  return subpath;
902
902
  }) : target;
903
903
  emitInvalidSegmentDeprecation(resolvedTarget, request, match, packageJsonUrl, internal, base, true);
@@ -912,12 +912,12 @@ var doubleSlashRegEx = /[/\\]{2}/;
912
912
  if (!resolvedPath.startsWith(packagePath)) throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
913
913
  if (subpath === '') return resolved;
914
914
  if (invalidSegmentRegEx.exec(subpath) !== null) {
915
- var request1 = pattern ? match.replace('*', function () {
915
+ var request1 = pattern ? match.replace('*', function() {
916
916
  return subpath;
917
917
  }) : match + subpath;
918
918
  if (deprecatedInvalidSegmentRegEx.exec(subpath) === null) {
919
919
  if (!isPathMap) {
920
- var resolvedTarget1 = pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, function () {
920
+ var resolvedTarget1 = pattern ? RegExpPrototypeSymbolReplace.call(patternRegEx, target, function() {
921
921
  return subpath;
922
922
  }) : target;
923
923
  emitInvalidSegmentDeprecation(resolvedTarget1, request1, match, packageJsonUrl, internal, base, false);
@@ -927,7 +927,7 @@ var doubleSlashRegEx = /[/\\]{2}/;
927
927
  }
928
928
  }
929
929
  if (pattern) {
930
- return new url.URL(RegExpPrototypeSymbolReplace.call(patternRegEx, resolved.href, function () {
930
+ return new url.URL(RegExpPrototypeSymbolReplace.call(patternRegEx, resolved.href, function() {
931
931
  return subpath;
932
932
  }));
933
933
  }
@@ -961,9 +961,9 @@ var doubleSlashRegEx = /[/\\]{2}/;
961
961
  if (targetList.length === 0) return null;
962
962
  /** @type {ErrnoException | null | undefined} */ var lastException;
963
963
  var i = -1;
964
- while (++i < targetList.length) {
964
+ while(++i < targetList.length){
965
965
  var targetItem = targetList[i];
966
- /** @type {URL | null} */ var resolveResult = undefined;
966
+ /** @type {URL | null} */ var resolveResult = void 0;
967
967
  try {
968
968
  resolveResult = resolvePackageTarget(packageJsonUrl, targetItem, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions);
969
969
  } catch (error) {
@@ -987,14 +987,14 @@ var doubleSlashRegEx = /[/\\]{2}/;
987
987
  if ((typeof target === "undefined" ? "undefined" : _type_of(target)) === 'object' && target !== null) {
988
988
  var keys = Object.getOwnPropertyNames(target);
989
989
  var i1 = -1;
990
- while (++i1 < keys.length) {
990
+ while(++i1 < keys.length){
991
991
  var key = keys[i1];
992
992
  if (isArrayIndex(key)) {
993
993
  throw new ERR_INVALID_PACKAGE_CONFIG(url.fileURLToPath(packageJsonUrl), base, '"exports" cannot contain numeric property keys.');
994
994
  }
995
995
  }
996
996
  i1 = -1;
997
- while (++i1 < keys.length) {
997
+ while(++i1 < keys.length){
998
998
  var key1 = keys[i1];
999
999
  if (key1 === 'default' || conditions && conditions.has(key1)) {
1000
1000
  // @ts-expect-error: indexable.
@@ -1023,7 +1023,7 @@ var doubleSlashRegEx = /[/\\]{2}/;
1023
1023
  var isConditionalSugar = false;
1024
1024
  var i = 0;
1025
1025
  var keyIndex = -1;
1026
- while (++keyIndex < keys.length) {
1026
+ while(++keyIndex < keys.length){
1027
1027
  var key = keys[keyIndex];
1028
1028
  var currentIsConditionalSugar = key === '' || key[0] !== '.';
1029
1029
  if (i++ === 0) {
@@ -1075,7 +1075,7 @@ var doubleSlashRegEx = /[/\\]{2}/;
1075
1075
  var bestMatchSubpath = '';
1076
1076
  var keys = Object.getOwnPropertyNames(exports);
1077
1077
  var i = -1;
1078
- while (++i < keys.length) {
1078
+ while(++i < keys.length){
1079
1079
  var key = keys[i];
1080
1080
  var patternIndex = key.indexOf('*');
1081
1081
  if (patternIndex !== -1 && packageSubpath.startsWith(key.slice(0, patternIndex))) {
@@ -1148,7 +1148,7 @@ var doubleSlashRegEx = /[/\\]{2}/;
1148
1148
  var bestMatchSubpath = '';
1149
1149
  var keys = Object.getOwnPropertyNames(imports);
1150
1150
  var i = -1;
1151
- while (++i < keys.length) {
1151
+ while(++i < keys.length){
1152
1152
  var key = keys[i];
1153
1153
  var patternIndex = key.indexOf('*');
1154
1154
  if (patternIndex !== -1 && name.startsWith(key.slice(0, -1))) {
@@ -1244,8 +1244,8 @@ var doubleSlashRegEx = /[/\\]{2}/;
1244
1244
  return legacyMainResolve(packageJsonUrl1, packageConfig1, base);
1245
1245
  }
1246
1246
  return new url.URL(packageSubpath, packageJsonUrl1);
1247
- // Cross-platform root check.
1248
- } while (packageJsonPath.length !== lastPath.length);
1247
+ // Cross-platform root check.
1248
+ }while (packageJsonPath.length !== lastPath.length);
1249
1249
  throw new ERR_MODULE_NOT_FOUND(packageName, url.fileURLToPath(base), false);
1250
1250
  }
1251
1251
  /**
@@ -1331,14 +1331,14 @@ var doubleSlashRegEx = /[/\\]{2}/;
1331
1331
  if (parentProtocol === 'http:' || parentProtocol === 'https:') {
1332
1332
  if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {
1333
1333
  // Avoid accessing the `protocol` property due to the lazy getters.
1334
- var parsedProtocol = parsed === null || parsed === undefined ? undefined : parsed.protocol;
1334
+ var parsedProtocol = parsed === null || parsed === void 0 ? void 0 : parsed.protocol;
1335
1335
  // `data:` and `blob:` disallowed due to allowing file: access via
1336
1336
  // indirection
1337
1337
  if (parsedProtocol && parsedProtocol !== 'https:' && parsedProtocol !== 'http:') {
1338
1338
  throw new ERR_NETWORK_IMPORT_DISALLOWED(specifier, parsedParentURL, 'remote imports cannot import from a local location.');
1339
1339
  }
1340
1340
  return {
1341
- url: (parsed === null || parsed === undefined ? undefined : parsed.href) || ''
1341
+ url: (parsed === null || parsed === void 0 ? void 0 : parsed.href) || ''
1342
1342
  };
1343
1343
  }
1344
1344
  if (module$1.builtinModules.includes(specifier)) {
@@ -1387,7 +1387,7 @@ var doubleSlashRegEx = /[/\\]{2}/;
1387
1387
  * @param {{parentURL?: string, conditions?: Array<string>}} context
1388
1388
  * @returns {{url: string, format?: string | null}}
1389
1389
  */ function defaultResolve(specifier) {
1390
- var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1390
+ var context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1391
1391
  var parentURL = context.parentURL;
1392
1392
  assert(parentURL !== undefined, 'expected `parentURL` to be defined');
1393
1393
  throwIfInvalidParentURL(parentURL);
@@ -1396,7 +1396,7 @@ var doubleSlashRegEx = /[/\\]{2}/;
1396
1396
  try {
1397
1397
  parsedParentURL = new url.URL(parentURL);
1398
1398
  } catch (e) {
1399
- // Ignore exception
1399
+ // Ignore exception
1400
1400
  }
1401
1401
  }
1402
1402
  /** @type {URL | undefined} */ var parsed;
@@ -1412,7 +1412,7 @@ var doubleSlashRegEx = /[/\\]{2}/;
1412
1412
  };
1413
1413
  }
1414
1414
  } catch (e) {
1415
- // Ignore exception
1415
+ // Ignore exception
1416
1416
  }
1417
1417
  // There are multiple deep branches that can either throw or return; instead
1418
1418
  // of duplicating that deeply nested logic for the possible returns, DRY and
@@ -15,7 +15,7 @@ function _interop_require_default(obj) {
15
15
  };
16
16
  }
17
17
  var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
18
- var resolve = _require('../../../assets/importMetaResolve.cjs').resolve;
18
+ var resolve = _require('../../../assets/import-meta-resolve.cjs').resolve;
19
19
  function importMetaResolve(specifier, url) {
20
20
  return resolve(specifier, url);
21
21
  }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/import-meta-resolve.ts"],"sourcesContent":["import Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst resolve = _require('../../../assets/import-meta-resolve.cjs').resolve;\n\nexport default function importMetaResolve(specifier: string, url: URL): string {\n return resolve(specifier, url);\n}\n"],"names":["importMetaResolve","_require","require","Module","createRequire","resolve","specifier","url"],"mappings":";;;;+BAKA;;;eAAwBA;;;6DALL;;;;;;AAEnB,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,UAAUJ,SAAS,2CAA2CI,OAAO;AAE5D,SAASL,kBAAkBM,SAAiB,EAAEC,GAAQ;IACnE,OAAOF,QAAQC,WAAWC;AAC5B"}
@@ -14,7 +14,7 @@ var _path = /*#__PURE__*/ _interop_require_default(require("path"));
14
14
  var _resolve = /*#__PURE__*/ _interop_require_default(require("resolve"));
15
15
  var _url = /*#__PURE__*/ _interop_require_default(require("url"));
16
16
  var _constantsts = require("./constants.js");
17
- var _importMetaResolvets = /*#__PURE__*/ _interop_require_default(require("./lib/importMetaResolve.js"));
17
+ var _importmetaresolvets = /*#__PURE__*/ _interop_require_default(require("./lib/import-meta-resolve.js"));
18
18
  var _urlFileUrlts = /*#__PURE__*/ _interop_require_wildcard(require("./lib/urlFileUrl.js"));
19
19
  function _interop_require_default(obj) {
20
20
  return obj && obj.__esModule ? obj : {
@@ -80,7 +80,7 @@ function toPath(specifier, context) {
80
80
  var parentPath1 = context ? getParentPath(context) : process.cwd();
81
81
  if (!useCJS) {
82
82
  try {
83
- var entryURL = (0, _importMetaResolvets.default)(specifier, pathToFileURL(parentPath1));
83
+ var entryURL = (0, _importmetaresolvets.default)(specifier, pathToFileURL(parentPath1));
84
84
  if (entryURL) return fileURLToPath(entryURL);
85
85
  } catch (_) {
86
86
  /* it may fail due to commonjs edge cases */ }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import isAbsolute from 'is-absolute';\nimport module from 'module';\nimport path from 'path';\nimport resolveCJS from 'resolve';\nimport url from 'url';\nimport { moduleRegEx } from './constants.ts';\nimport importMetaResolve from './lib/importMetaResolve.ts';\nimport * as urlPolyfills from './lib/urlFileUrl.ts';\nimport type { Context } from './types.ts';\n\nconst useCJS = !module.createRequire;\nconst fileURLToPath = url.fileURLToPath || urlPolyfills.fileURLToPath;\nconst pathToFileURL = url.pathToFileURL || urlPolyfills.pathToFileURL;\n\nfunction getParentPath(context: Context): string {\n if (context.parentPath) return path.dirname(context.parentPath);\n return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();\n}\n\nexport default function toPath(specifier: string, context?: Context): string {\n if (specifier.startsWith('file:')) return fileURLToPath(specifier);\n if (isAbsolute(specifier)) return specifier;\n if (specifier[0] === '.') {\n const parentPath = context ? getParentPath(context) : process.cwd();\n return path.join(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n if (!useCJS) {\n try {\n const entryURL = importMetaResolve(specifier, pathToFileURL(parentPath));\n if (entryURL) return fileURLToPath(entryURL);\n } catch (_) {\n /* it may fail due to commonjs edge cases */\n }\n }\n const entryPath = resolveCJS.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n });\n if (entryPath) return entryPath;\n }\n\n return specifier;\n}\n"],"names":["toPath","useCJS","module","createRequire","fileURLToPath","url","urlPolyfills","pathToFileURL","getParentPath","context","parentPath","path","dirname","parentURL","process","cwd","specifier","startsWith","isAbsolute","join","moduleRegEx","test","entryURL","importMetaResolve","_","entryPath","resolveCJS","sync","basedir","extensions"],"mappings":";;;;+BAmBA;;;eAAwBA;;;iEAnBD;6DACJ;2DACF;8DACM;0DACP;2BACY;0EACE;oEACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG9B,IAAMC,SAAS,CAACC,eAAM,CAACC,aAAa;AACpC,IAAMC,gBAAgBC,YAAG,CAACD,aAAa,IAAIE,cAAaF,aAAa;AACrE,IAAMG,gBAAgBF,YAAG,CAACE,aAAa,IAAID,cAAaC,aAAa;AAErE,SAASC,cAAcC,OAAgB;IACrC,IAAIA,QAAQC,UAAU,EAAE,OAAOC,aAAI,CAACC,OAAO,CAACH,QAAQC,UAAU;IAC9D,OAAOD,QAAQI,SAAS,GAAGF,aAAI,CAACC,OAAO,CAACZ,OAAOS,QAAQI,SAAS,KAAKC,QAAQC,GAAG;AAClF;AAEe,SAASf,OAAOgB,SAAiB,EAAEP,OAAiB;IACjE,IAAIO,UAAUC,UAAU,CAAC,UAAU,OAAOb,cAAcY;IACxD,IAAIE,IAAAA,mBAAU,EAACF,YAAY,OAAOA;IAClC,IAAIA,SAAS,CAAC,EAAE,KAAK,KAAK;QACxB,IAAMN,aAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,OAAOJ,aAAI,CAACQ,IAAI,CAACT,YAAYM;IAC/B;IACA,IAAII,wBAAW,CAACC,IAAI,CAACL,YAAY;QAC/B,IAAMN,cAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,IAAI,CAACd,QAAQ;YACX,IAAI;gBACF,IAAMqB,WAAWC,IAAAA,4BAAiB,EAACP,WAAWT,cAAcG;gBAC5D,IAAIY,UAAU,OAAOlB,cAAckB;YACrC,EAAE,OAAOE,GAAG;YACV,0CAA0C,GAC5C;QACF;QACA,IAAMC,YAAYC,gBAAU,CAACC,IAAI,CAACX,WAAW;YAC3CY,SAASlB;YACTmB,YAAY;gBAAC;gBAAO;gBAAS;gBAAS;aAAO;QAC/C;QACA,IAAIJ,WAAW,OAAOA;IACxB;IAEA,OAAOT;AACT"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import isAbsolute from 'is-absolute';\nimport module from 'module';\nimport path from 'path';\nimport resolveCJS from 'resolve';\nimport url from 'url';\nimport { moduleRegEx } from './constants.ts';\nimport importMetaResolve from './lib/import-meta-resolve.ts';\nimport * as urlPolyfills from './lib/urlFileUrl.ts';\nimport type { Context } from './types.ts';\n\nconst useCJS = !module.createRequire;\nconst fileURLToPath = url.fileURLToPath || urlPolyfills.fileURLToPath;\nconst pathToFileURL = url.pathToFileURL || urlPolyfills.pathToFileURL;\n\nfunction getParentPath(context: Context): string {\n if (context.parentPath) return path.dirname(context.parentPath);\n return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();\n}\n\nexport default function toPath(specifier: string, context?: Context): string {\n if (specifier.startsWith('file:')) return fileURLToPath(specifier);\n if (isAbsolute(specifier)) return specifier;\n if (specifier[0] === '.') {\n const parentPath = context ? getParentPath(context) : process.cwd();\n return path.join(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n if (!useCJS) {\n try {\n const entryURL = importMetaResolve(specifier, pathToFileURL(parentPath));\n if (entryURL) return fileURLToPath(entryURL);\n } catch (_) {\n /* it may fail due to commonjs edge cases */\n }\n }\n const entryPath = resolveCJS.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n });\n if (entryPath) return entryPath;\n }\n\n return specifier;\n}\n"],"names":["toPath","useCJS","module","createRequire","fileURLToPath","url","urlPolyfills","pathToFileURL","getParentPath","context","parentPath","path","dirname","parentURL","process","cwd","specifier","startsWith","isAbsolute","join","moduleRegEx","test","entryURL","importMetaResolve","_","entryPath","resolveCJS","sync","basedir","extensions"],"mappings":";;;;+BAmBA;;;eAAwBA;;;iEAnBD;6DACJ;2DACF;8DACM;0DACP;2BACY;0EACE;oEACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG9B,IAAMC,SAAS,CAACC,eAAM,CAACC,aAAa;AACpC,IAAMC,gBAAgBC,YAAG,CAACD,aAAa,IAAIE,cAAaF,aAAa;AACrE,IAAMG,gBAAgBF,YAAG,CAACE,aAAa,IAAID,cAAaC,aAAa;AAErE,SAASC,cAAcC,OAAgB;IACrC,IAAIA,QAAQC,UAAU,EAAE,OAAOC,aAAI,CAACC,OAAO,CAACH,QAAQC,UAAU;IAC9D,OAAOD,QAAQI,SAAS,GAAGF,aAAI,CAACC,OAAO,CAACZ,OAAOS,QAAQI,SAAS,KAAKC,QAAQC,GAAG;AAClF;AAEe,SAASf,OAAOgB,SAAiB,EAAEP,OAAiB;IACjE,IAAIO,UAAUC,UAAU,CAAC,UAAU,OAAOb,cAAcY;IACxD,IAAIE,IAAAA,mBAAU,EAACF,YAAY,OAAOA;IAClC,IAAIA,SAAS,CAAC,EAAE,KAAK,KAAK;QACxB,IAAMN,aAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,OAAOJ,aAAI,CAACQ,IAAI,CAACT,YAAYM;IAC/B;IACA,IAAII,wBAAW,CAACC,IAAI,CAACL,YAAY;QAC/B,IAAMN,cAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,IAAI,CAACd,QAAQ;YACX,IAAI;gBACF,IAAMqB,WAAWC,IAAAA,4BAAiB,EAACP,WAAWT,cAAcG;gBAC5D,IAAIY,UAAU,OAAOlB,cAAckB;YACrC,EAAE,OAAOE,GAAG;YACV,0CAA0C,GAC5C;QACF;QACA,IAAMC,YAAYC,gBAAU,CAACC,IAAI,CAACX,WAAW;YAC3CY,SAASlB;YACTmB,YAAY;gBAAC;gBAAO;gBAAS;gBAAS;aAAO;QAC/C;QACA,IAAIJ,WAAW,OAAOA;IACxB;IAEA,OAAOT;AACT"}
@@ -1,6 +1,6 @@
1
1
  import Module from 'module';
2
2
  const _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;
3
- const resolve = _require('../../../assets/importMetaResolve.cjs').resolve;
3
+ const resolve = _require('../../../assets/import-meta-resolve.cjs').resolve;
4
4
  export default function importMetaResolve(specifier, url) {
5
5
  return resolve(specifier, url);
6
6
  }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/import-meta-resolve.ts"],"sourcesContent":["import Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst resolve = _require('../../../assets/import-meta-resolve.cjs').resolve;\n\nexport default function importMetaResolve(specifier: string, url: URL): string {\n return resolve(specifier, url);\n}\n"],"names":["Module","_require","require","createRequire","url","resolve","importMetaResolve","specifier"],"mappings":"AAAA,OAAOA,YAAY,SAAS;AAE5B,MAAMC,WAAW,OAAOC,YAAY,cAAcF,OAAOG,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAC1F,MAAMG,UAAUJ,SAAS,2CAA2CI,OAAO;AAE3E,eAAe,SAASC,kBAAkBC,SAAiB,EAAEH,GAAQ;IACnE,OAAOC,QAAQE,WAAWH;AAC5B"}
@@ -4,7 +4,7 @@ import path from 'path';
4
4
  import resolveCJS from 'resolve';
5
5
  import url from 'url';
6
6
  import { moduleRegEx } from './constants.js';
7
- import importMetaResolve from './lib/importMetaResolve.js';
7
+ import importMetaResolve from './lib/import-meta-resolve.js';
8
8
  import * as urlPolyfills from './lib/urlFileUrl.js';
9
9
  const useCJS = !module.createRequire;
10
10
  const fileURLToPath = url.fileURLToPath || urlPolyfills.fileURLToPath;
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import isAbsolute from 'is-absolute';\nimport module from 'module';\nimport path from 'path';\nimport resolveCJS from 'resolve';\nimport url from 'url';\nimport { moduleRegEx } from './constants.ts';\nimport importMetaResolve from './lib/importMetaResolve.ts';\nimport * as urlPolyfills from './lib/urlFileUrl.ts';\nimport type { Context } from './types.ts';\n\nconst useCJS = !module.createRequire;\nconst fileURLToPath = url.fileURLToPath || urlPolyfills.fileURLToPath;\nconst pathToFileURL = url.pathToFileURL || urlPolyfills.pathToFileURL;\n\nfunction getParentPath(context: Context): string {\n if (context.parentPath) return path.dirname(context.parentPath);\n return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();\n}\n\nexport default function toPath(specifier: string, context?: Context): string {\n if (specifier.startsWith('file:')) return fileURLToPath(specifier);\n if (isAbsolute(specifier)) return specifier;\n if (specifier[0] === '.') {\n const parentPath = context ? getParentPath(context) : process.cwd();\n return path.join(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n if (!useCJS) {\n try {\n const entryURL = importMetaResolve(specifier, pathToFileURL(parentPath));\n if (entryURL) return fileURLToPath(entryURL);\n } catch (_) {\n /* it may fail due to commonjs edge cases */\n }\n }\n const entryPath = resolveCJS.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n });\n if (entryPath) return entryPath;\n }\n\n return specifier;\n}\n"],"names":["isAbsolute","module","path","resolveCJS","url","moduleRegEx","importMetaResolve","urlPolyfills","useCJS","createRequire","fileURLToPath","pathToFileURL","getParentPath","context","parentPath","dirname","parentURL","toPath","process","cwd","specifier","startsWith","join","test","entryURL","_","entryPath","sync","basedir","extensions"],"mappings":"AAAA,OAAOA,gBAAgB,cAAc;AACrC,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,OAAO;AACxB,OAAOC,gBAAgB,UAAU;AACjC,OAAOC,SAAS,MAAM;AACtB,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,OAAOC,uBAAuB,6BAA6B;AAC3D,YAAYC,kBAAkB,sBAAsB;AAGpD,MAAMC,SAAS,CAACP,OAAOQ,aAAa;AACpC,MAAMC,gBAAgBN,IAAIM,aAAa,IAAIH,aAAaG,aAAa;AACrE,MAAMC,gBAAgBP,IAAIO,aAAa,IAAIJ,aAAaI,aAAa;AAErE,SAASC,cAAcC,OAAgB;IACrC,IAAIA,QAAQC,UAAU,EAAE,OAAOZ,KAAKa,OAAO,CAACF,QAAQC,UAAU;IAC9D,OAAOD,QAAQG,SAAS,GAAGd,KAAKa,OAAO,CAACE,OAAOJ,QAAQG,SAAS,KAAKE,QAAQC,GAAG;AAClF;AAEA,eAAe,SAASF,OAAOG,SAAiB,EAAEP,OAAiB;IACjE,IAAIO,UAAUC,UAAU,CAAC,UAAU,OAAOX,cAAcU;IACxD,IAAIpB,WAAWoB,YAAY,OAAOA;IAClC,IAAIA,SAAS,CAAC,EAAE,KAAK,KAAK;QACxB,MAAMN,aAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,OAAOjB,KAAKoB,IAAI,CAACR,YAAYM;IAC/B;IACA,IAAIf,YAAYkB,IAAI,CAACH,YAAY;QAC/B,MAAMN,aAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,IAAI,CAACX,QAAQ;YACX,IAAI;gBACF,MAAMgB,WAAWlB,kBAAkBc,WAAWT,cAAcG;gBAC5D,IAAIU,UAAU,OAAOd,cAAcc;YACrC,EAAE,OAAOC,GAAG;YACV,0CAA0C,GAC5C;QACF;QACA,MAAMC,YAAYvB,WAAWwB,IAAI,CAACP,WAAW;YAC3CQ,SAASd;YACTe,YAAY;gBAAC;gBAAO;gBAAS;gBAAS;aAAO;QAC/C;QACA,IAAIH,WAAW,OAAOA;IACxB;IAEA,OAAON;AACT"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/toPath.ts"],"sourcesContent":["import isAbsolute from 'is-absolute';\nimport module from 'module';\nimport path from 'path';\nimport resolveCJS from 'resolve';\nimport url from 'url';\nimport { moduleRegEx } from './constants.ts';\nimport importMetaResolve from './lib/import-meta-resolve.ts';\nimport * as urlPolyfills from './lib/urlFileUrl.ts';\nimport type { Context } from './types.ts';\n\nconst useCJS = !module.createRequire;\nconst fileURLToPath = url.fileURLToPath || urlPolyfills.fileURLToPath;\nconst pathToFileURL = url.pathToFileURL || urlPolyfills.pathToFileURL;\n\nfunction getParentPath(context: Context): string {\n if (context.parentPath) return path.dirname(context.parentPath);\n return context.parentURL ? path.dirname(toPath(context.parentURL)) : process.cwd();\n}\n\nexport default function toPath(specifier: string, context?: Context): string {\n if (specifier.startsWith('file:')) return fileURLToPath(specifier);\n if (isAbsolute(specifier)) return specifier;\n if (specifier[0] === '.') {\n const parentPath = context ? getParentPath(context) : process.cwd();\n return path.join(parentPath, specifier);\n }\n if (moduleRegEx.test(specifier)) {\n const parentPath = context ? getParentPath(context) : process.cwd();\n if (!useCJS) {\n try {\n const entryURL = importMetaResolve(specifier, pathToFileURL(parentPath));\n if (entryURL) return fileURLToPath(entryURL);\n } catch (_) {\n /* it may fail due to commonjs edge cases */\n }\n }\n const entryPath = resolveCJS.sync(specifier, {\n basedir: parentPath,\n extensions: ['.js', '.json', '.node', '.mjs'],\n });\n if (entryPath) return entryPath;\n }\n\n return specifier;\n}\n"],"names":["isAbsolute","module","path","resolveCJS","url","moduleRegEx","importMetaResolve","urlPolyfills","useCJS","createRequire","fileURLToPath","pathToFileURL","getParentPath","context","parentPath","dirname","parentURL","toPath","process","cwd","specifier","startsWith","join","test","entryURL","_","entryPath","sync","basedir","extensions"],"mappings":"AAAA,OAAOA,gBAAgB,cAAc;AACrC,OAAOC,YAAY,SAAS;AAC5B,OAAOC,UAAU,OAAO;AACxB,OAAOC,gBAAgB,UAAU;AACjC,OAAOC,SAAS,MAAM;AACtB,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,OAAOC,uBAAuB,+BAA+B;AAC7D,YAAYC,kBAAkB,sBAAsB;AAGpD,MAAMC,SAAS,CAACP,OAAOQ,aAAa;AACpC,MAAMC,gBAAgBN,IAAIM,aAAa,IAAIH,aAAaG,aAAa;AACrE,MAAMC,gBAAgBP,IAAIO,aAAa,IAAIJ,aAAaI,aAAa;AAErE,SAASC,cAAcC,OAAgB;IACrC,IAAIA,QAAQC,UAAU,EAAE,OAAOZ,KAAKa,OAAO,CAACF,QAAQC,UAAU;IAC9D,OAAOD,QAAQG,SAAS,GAAGd,KAAKa,OAAO,CAACE,OAAOJ,QAAQG,SAAS,KAAKE,QAAQC,GAAG;AAClF;AAEA,eAAe,SAASF,OAAOG,SAAiB,EAAEP,OAAiB;IACjE,IAAIO,UAAUC,UAAU,CAAC,UAAU,OAAOX,cAAcU;IACxD,IAAIpB,WAAWoB,YAAY,OAAOA;IAClC,IAAIA,SAAS,CAAC,EAAE,KAAK,KAAK;QACxB,MAAMN,aAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,OAAOjB,KAAKoB,IAAI,CAACR,YAAYM;IAC/B;IACA,IAAIf,YAAYkB,IAAI,CAACH,YAAY;QAC/B,MAAMN,aAAaD,UAAUD,cAAcC,WAAWK,QAAQC,GAAG;QACjE,IAAI,CAACX,QAAQ;YACX,IAAI;gBACF,MAAMgB,WAAWlB,kBAAkBc,WAAWT,cAAcG;gBAC5D,IAAIU,UAAU,OAAOd,cAAcc;YACrC,EAAE,OAAOC,GAAG;YACV,0CAA0C,GAC5C;QACF;QACA,MAAMC,YAAYvB,WAAWwB,IAAI,CAACP,WAAW;YAC3CQ,SAASd;YACTe,YAAY;gBAAC;gBAAO;gBAAS;gBAAS;aAAO;QAC/C;QACA,IAAIH,WAAW,OAAOA;IACxB;IAEA,OAAON;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-swc-transform",
3
- "version": "2.2.6",
3
+ "version": "2.2.8",
4
4
  "description": "Typescript transformers for swc. Supports Node >= 0.8",
5
5
  "keywords": [
6
6
  "matcher",
@@ -48,12 +48,12 @@
48
48
  "exit": "^0.1.2",
49
49
  "fs-iterator": "^6.0.5",
50
50
  "get-tsconfig-compat": "^2.0.3",
51
- "install-optional": "^0.1.75",
51
+ "install-optional": "^0.1.76",
52
52
  "is-absolute": "^1.0.0",
53
53
  "lodash.find": "^4.6.0",
54
54
  "minimatch": "^3.1.2",
55
55
  "mkdirp-classic": "^0.5.3",
56
- "node-version-call": "^1.8.4",
56
+ "node-version-call": "^1.8.5",
57
57
  "path-posix": "^1.0.0",
58
58
  "queue-cb": "^1.5.5",
59
59
  "resolve": "^1.22.10",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/importMetaResolve.ts"],"sourcesContent":["import Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst resolve = _require('../../../assets/importMetaResolve.cjs').resolve;\n\nexport default function importMetaResolve(specifier: string, url: URL): string {\n return resolve(specifier, url);\n}\n"],"names":["importMetaResolve","_require","require","Module","createRequire","resolve","specifier","url"],"mappings":";;;;+BAKA;;;eAAwBA;;;6DALL;;;;;;AAEnB,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAC1F,IAAMG,UAAUJ,SAAS,yCAAyCI,OAAO;AAE1D,SAASL,kBAAkBM,SAAiB,EAAEC,GAAQ;IACnE,OAAOF,QAAQC,WAAWC;AAC5B"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/typescript/ts-swc-transform/src/lib/importMetaResolve.ts"],"sourcesContent":["import Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\nconst resolve = _require('../../../assets/importMetaResolve.cjs').resolve;\n\nexport default function importMetaResolve(specifier: string, url: URL): string {\n return resolve(specifier, url);\n}\n"],"names":["Module","_require","require","createRequire","url","resolve","importMetaResolve","specifier"],"mappings":"AAAA,OAAOA,YAAY,SAAS;AAE5B,MAAMC,WAAW,OAAOC,YAAY,cAAcF,OAAOG,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAC1F,MAAMG,UAAUJ,SAAS,yCAAyCI,OAAO;AAEzE,eAAe,SAASC,kBAAkBC,SAAiB,EAAEH,GAAQ;IACnE,OAAOC,QAAQE,WAAWH;AAC5B"}