@atlaspack/transformer-js 3.3.11-typescript-bc4459c37.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/JSTransformer.js +43 -82
- package/package.json +12 -15
- package/src/{JSTransformer.ts → JSTransformer.js} +80 -113
- package/LICENSE +0 -201
- package/lib/JSTransformer.d.ts +0 -3
package/lib/JSTransformer.js
CHANGED
|
@@ -188,25 +188,18 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
188
188
|
})) === null || _await$config$getConf === void 0 || (_await$config$getConf = _await$config$getConf.contents) === null || _await$config$getConf === void 0 ? void 0 : _await$config$getConf.compilerOptions;
|
|
189
189
|
|
|
190
190
|
// Use explicitly defined JSX options in tsconfig.json over inferred values from dependencies.
|
|
191
|
-
pragma = (compilerOptions === null || compilerOptions === void 0 ? void 0 : compilerOptions.jsxFactory) || (
|
|
192
|
-
|
|
193
|
-
reactLib ? JSX_PRAGMA[reactLib].pragma : undefined);
|
|
194
|
-
pragmaFrag = (compilerOptions === null || compilerOptions === void 0 ? void 0 : compilerOptions.jsxFragmentFactory) || (
|
|
195
|
-
// @ts-expect-error TS7053
|
|
196
|
-
reactLib ? JSX_PRAGMA[reactLib].pragmaFrag : undefined);
|
|
191
|
+
pragma = (compilerOptions === null || compilerOptions === void 0 ? void 0 : compilerOptions.jsxFactory) || (reactLib ? JSX_PRAGMA[reactLib].pragma : undefined);
|
|
192
|
+
pragmaFrag = (compilerOptions === null || compilerOptions === void 0 ? void 0 : compilerOptions.jsxFragmentFactory) || (reactLib ? JSX_PRAGMA[reactLib].pragmaFrag : undefined);
|
|
197
193
|
if ((compilerOptions === null || compilerOptions === void 0 ? void 0 : compilerOptions.jsx) === 'react-jsx' || (compilerOptions === null || compilerOptions === void 0 ? void 0 : compilerOptions.jsx) === 'react-jsxdev' || compilerOptions !== null && compilerOptions !== void 0 && compilerOptions.jsxImportSource) {
|
|
198
194
|
jsxImportSource = compilerOptions === null || compilerOptions === void 0 ? void 0 : compilerOptions.jsxImportSource;
|
|
199
195
|
automaticJSXRuntime = true;
|
|
200
196
|
} else if (reactLib) {
|
|
201
197
|
var _JSX_PRAGMA$effective, _packageJson$dependen3, _packageJson$devDepen3, _packageJson$peerDepe3, _semver$minVersion;
|
|
202
198
|
let effectiveReactLib = packageJson !== null && packageJson !== void 0 && packageJson.alias && packageJson.alias['react'] === 'preact/compat' ? 'preact' : reactLib;
|
|
203
|
-
// @ts-expect-error TS7053
|
|
204
199
|
let automaticVersion = (_JSX_PRAGMA$effective = JSX_PRAGMA[effectiveReactLib]) === null || _JSX_PRAGMA$effective === void 0 ? void 0 : _JSX_PRAGMA$effective.automatic;
|
|
205
200
|
let reactLibVersion = (packageJson === null || packageJson === void 0 || (_packageJson$dependen3 = packageJson.dependencies) === null || _packageJson$dependen3 === void 0 ? void 0 : _packageJson$dependen3[effectiveReactLib]) || (packageJson === null || packageJson === void 0 || (_packageJson$devDepen3 = packageJson.devDependencies) === null || _packageJson$devDepen3 === void 0 ? void 0 : _packageJson$devDepen3[effectiveReactLib]) || (packageJson === null || packageJson === void 0 || (_packageJson$peerDepe3 = packageJson.peerDependencies) === null || _packageJson$peerDepe3 === void 0 ? void 0 : _packageJson$peerDepe3[effectiveReactLib]);
|
|
206
|
-
// @ts-expect-error TS2322
|
|
207
201
|
reactLibVersion = reactLibVersion ? _semver().default.validRange(reactLibVersion) : null;
|
|
208
|
-
let minReactLibVersion = reactLibVersion !== null && reactLibVersion !== '*' ?
|
|
209
|
-
(_semver$minVersion = _semver().default.minVersion(reactLibVersion)) === null || _semver$minVersion === void 0 ? void 0 : _semver$minVersion.toString() : null;
|
|
202
|
+
let minReactLibVersion = reactLibVersion !== null && reactLibVersion !== '*' ? (_semver$minVersion = _semver().default.minVersion(reactLibVersion)) === null || _semver$minVersion === void 0 ? void 0 : _semver$minVersion.toString() : null;
|
|
210
203
|
automaticJSXRuntime = automaticVersion && !(compilerOptions !== null && compilerOptions !== void 0 && compilerOptions.jsxFactory) && minReactLibVersion != null && _semver().default.satisfies(minReactLibVersion, automaticVersion, {
|
|
211
204
|
includePrerelease: true
|
|
212
205
|
});
|
|
@@ -249,16 +242,10 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
249
242
|
},
|
|
250
243
|
// FIXME
|
|
251
244
|
'@atlaspack/transformer-js', 'Invalid config for @atlaspack/transformer-js');
|
|
252
|
-
|
|
253
|
-
// @ts-expect-error TS2339
|
|
254
245
|
magicComments = ((_conf$contents = conf.contents) === null || _conf$contents === void 0 ? void 0 : _conf$contents.magicComments) ?? magicComments;
|
|
255
|
-
// @ts-expect-error TS2339
|
|
256
246
|
inlineEnvironment = ((_conf$contents2 = conf.contents) === null || _conf$contents2 === void 0 ? void 0 : _conf$contents2.inlineEnvironment) ?? inlineEnvironment;
|
|
257
|
-
// @ts-expect-error TS2339
|
|
258
247
|
inlineFS = ((_conf$contents3 = conf.contents) === null || _conf$contents3 === void 0 ? void 0 : _conf$contents3.inlineFS) ?? inlineFS;
|
|
259
|
-
inlineConstants =
|
|
260
|
-
// @ts-expect-error TS2339
|
|
261
|
-
((_conf$contents4 = conf.contents) === null || _conf$contents4 === void 0 ? void 0 : _conf$contents4.unstable_inlineConstants) ?? inlineConstants;
|
|
248
|
+
inlineConstants = ((_conf$contents4 = conf.contents) === null || _conf$contents4 === void 0 ? void 0 : _conf$contents4.unstable_inlineConstants) ?? inlineConstants;
|
|
262
249
|
}
|
|
263
250
|
return {
|
|
264
251
|
isJSX,
|
|
@@ -301,22 +288,17 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
301
288
|
for (let browser of browsers) {
|
|
302
289
|
let [name, version] = browser.split(' ');
|
|
303
290
|
if (BROWSER_MAPPING.hasOwnProperty(name)) {
|
|
304
|
-
// @ts-expect-error TS7053
|
|
305
291
|
name = BROWSER_MAPPING[name];
|
|
306
292
|
if (!name) {
|
|
307
293
|
continue;
|
|
308
294
|
}
|
|
309
295
|
}
|
|
310
296
|
let [major, minor = '0', patch = '0'] = version.split('-')[0].split('.');
|
|
311
|
-
// @ts-expect-error TS2345
|
|
312
297
|
if (isNaN(major) || isNaN(minor) || isNaN(patch)) {
|
|
313
298
|
continue;
|
|
314
299
|
}
|
|
315
300
|
let semverVersion = `${major}.${minor}.${patch}`;
|
|
316
|
-
|
|
317
|
-
// @ts-expect-error TS2345
|
|
318
301
|
if (targets[name] == null || _semver().default.gt(targets[name], semverVersion)) {
|
|
319
|
-
// @ts-expect-error TS7053
|
|
320
302
|
targets[name] = semverVersion;
|
|
321
303
|
}
|
|
322
304
|
}
|
|
@@ -327,6 +309,8 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
327
309
|
};
|
|
328
310
|
}
|
|
329
311
|
let env = {};
|
|
312
|
+
|
|
313
|
+
// $FlowFixMe
|
|
330
314
|
if (!(config !== null && config !== void 0 && config.inlineEnvironment)) {
|
|
331
315
|
if (options.env.NODE_ENV != null) {
|
|
332
316
|
env.NODE_ENV = options.env.NODE_ENV;
|
|
@@ -335,7 +319,9 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
335
319
|
env.ATLASPACK_BUILD_ENV = 'test';
|
|
336
320
|
}
|
|
337
321
|
} else if (Array.isArray(config === null || config === void 0 ? void 0 : config.inlineEnvironment)) {
|
|
338
|
-
for (let match of (0, _utils().globMatch)(Object.keys(options.env),
|
|
322
|
+
for (let match of (0, _utils().globMatch)(Object.keys(options.env),
|
|
323
|
+
// $FlowFixMe
|
|
324
|
+
config.inlineEnvironment)) {
|
|
339
325
|
env[match] = String(options.env[match]);
|
|
340
326
|
}
|
|
341
327
|
} else {
|
|
@@ -346,49 +332,38 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
346
332
|
}
|
|
347
333
|
}
|
|
348
334
|
let supportsModuleWorkers = asset.env.shouldScopeHoist && asset.env.supports('worker-module', true);
|
|
335
|
+
// $FlowFixMe
|
|
349
336
|
let isJSX = Boolean(config === null || config === void 0 ? void 0 : config.isJSX);
|
|
350
337
|
if (asset.isSource) {
|
|
351
338
|
if (asset.type === 'ts') {
|
|
352
339
|
isJSX = false;
|
|
353
340
|
} else if (!isJSX) {
|
|
354
|
-
// @ts-expect-error TS7053
|
|
355
341
|
isJSX = Boolean(JSX_EXTENSIONS[asset.type]);
|
|
356
342
|
}
|
|
357
343
|
}
|
|
358
344
|
let macroAssets = [];
|
|
359
345
|
let {
|
|
360
|
-
// @ts-expect-error TS2339
|
|
361
346
|
dependencies,
|
|
362
|
-
// @ts-expect-error TS2339
|
|
363
347
|
code: compiledCode,
|
|
364
|
-
// @ts-expect-error TS2339
|
|
365
348
|
map,
|
|
366
|
-
// @ts-expect-error TS2339
|
|
367
349
|
shebang,
|
|
368
|
-
// @ts-expect-error TS2339
|
|
369
350
|
hoist_result,
|
|
370
|
-
// @ts-expect-error TS2339
|
|
371
351
|
symbol_result,
|
|
372
|
-
// @ts-expect-error TS2339
|
|
373
352
|
is_empty_or_empty_export,
|
|
374
|
-
// @ts-expect-error TS2339
|
|
375
353
|
needs_esm_helpers,
|
|
376
|
-
// @ts-expect-error TS2339
|
|
377
354
|
diagnostics,
|
|
378
|
-
// @ts-expect-error TS2339
|
|
379
355
|
used_env,
|
|
380
|
-
// @ts-expect-error TS2339
|
|
381
356
|
has_node_replacements,
|
|
382
|
-
// @ts-expect-error TS2339
|
|
383
357
|
is_constant_module,
|
|
384
|
-
|
|
385
|
-
|
|
358
|
+
conditions,
|
|
359
|
+
magic_comments
|
|
386
360
|
} = await (_rust().transformAsync || _rust().transform)({
|
|
387
361
|
filename: asset.filePath,
|
|
388
362
|
code,
|
|
389
363
|
module_id: asset.id,
|
|
390
364
|
project_root: options.projectRoot,
|
|
391
365
|
replace_env: !asset.env.isNode(),
|
|
366
|
+
// $FlowFixMe
|
|
392
367
|
inline_fs: Boolean(config === null || config === void 0 ? void 0 : config.inlineFS) && !asset.env.isNode(),
|
|
393
368
|
insert_node_globals: !asset.env.isNode() && asset.env.sourceType !== 'script',
|
|
394
369
|
node_replacer: asset.env.isNode(),
|
|
@@ -397,13 +372,21 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
397
372
|
env,
|
|
398
373
|
is_type_script: asset.type === 'ts' || asset.type === 'tsx',
|
|
399
374
|
is_jsx: isJSX,
|
|
375
|
+
// $FlowFixMe
|
|
400
376
|
jsx_pragma: config === null || config === void 0 ? void 0 : config.pragma,
|
|
377
|
+
// $FlowFixMe
|
|
401
378
|
jsx_pragma_frag: config === null || config === void 0 ? void 0 : config.pragmaFrag,
|
|
379
|
+
// $FlowFixMe
|
|
402
380
|
automatic_jsx_runtime: Boolean(config === null || config === void 0 ? void 0 : config.automaticJSXRuntime),
|
|
381
|
+
// $FlowFixMe
|
|
403
382
|
jsx_import_source: config === null || config === void 0 ? void 0 : config.jsxImportSource,
|
|
404
383
|
is_development: options.mode === 'development',
|
|
405
|
-
react_refresh: asset.env.isBrowser() && !asset.env.isLibrary && !asset.env.isWorker() && !asset.env.isWorklet() &&
|
|
384
|
+
react_refresh: asset.env.isBrowser() && !asset.env.isLibrary && !asset.env.isWorker() && !asset.env.isWorklet() &&
|
|
385
|
+
// $FlowFixMe
|
|
386
|
+
Boolean(config === null || config === void 0 ? void 0 : config.reactRefresh),
|
|
387
|
+
// $FlowFixMe
|
|
406
388
|
decorators: Boolean(config === null || config === void 0 ? void 0 : config.decorators),
|
|
389
|
+
// $FlowFixMe
|
|
407
390
|
use_define_for_class_fields: Boolean(config === null || config === void 0 ? void 0 : config.useDefineForClassFields),
|
|
408
391
|
targets,
|
|
409
392
|
source_maps: !!asset.env.sourceMap,
|
|
@@ -415,18 +398,23 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
415
398
|
trace_bailouts: options.logLevel === 'verbose',
|
|
416
399
|
is_swc_helpers: /@swc[/\\]helpers/.test(asset.filePath),
|
|
417
400
|
standalone: asset.query.has('standalone'),
|
|
401
|
+
// $FlowFixMe
|
|
418
402
|
inline_constants: config.inlineConstants,
|
|
419
403
|
conditional_bundling: options.featureFlags.conditionalBundlingApi,
|
|
420
404
|
hmr_improvements: options.featureFlags.hmrImprovements,
|
|
421
405
|
computed_properties_fix: options.featureFlags.unusedComputedPropertyFix,
|
|
422
|
-
magic_comments:
|
|
406
|
+
magic_comments:
|
|
407
|
+
// $FlowFixMe
|
|
408
|
+
Boolean(config === null || config === void 0 ? void 0 : config.magicComments) || (0, _featureFlags().getFeatureFlag)('supportWebpackChunkName'),
|
|
423
409
|
callMacro: asset.isSource ? async (err, src, exportName, args, loc) => {
|
|
424
410
|
let mod;
|
|
425
411
|
try {
|
|
426
412
|
mod = await options.packageManager.require(src, asset.filePath);
|
|
427
413
|
|
|
428
414
|
// Default interop for CommonJS modules.
|
|
429
|
-
if (exportName === 'default' && !mod.__esModule &&
|
|
415
|
+
if (exportName === 'default' && !mod.__esModule &&
|
|
416
|
+
// $FlowFixMe
|
|
417
|
+
Object.prototype.toString.call(config) !== '[object Module]') {
|
|
430
418
|
mod = {
|
|
431
419
|
default: mod
|
|
432
420
|
};
|
|
@@ -450,7 +438,6 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
450
438
|
if (asset.env.sourceMap) {
|
|
451
439
|
// Generate a source map that maps each line of the asset to the original macro call.
|
|
452
440
|
map = new (_sourceMap().default)(options.projectRoot);
|
|
453
|
-
// @ts-expect-error TS2304
|
|
454
441
|
let mappings = [];
|
|
455
442
|
let line = 1;
|
|
456
443
|
for (let i = 0; i <= a.content.length; i++) {
|
|
@@ -471,7 +458,6 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
471
458
|
}
|
|
472
459
|
map.addIndexedMappings(mappings);
|
|
473
460
|
if (originalMap) {
|
|
474
|
-
// @ts-expect-error TS2345
|
|
475
461
|
map.extends(originalMap);
|
|
476
462
|
} else {
|
|
477
463
|
map.setSourceContent(asset.filePath, code.toString());
|
|
@@ -526,9 +512,7 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
526
512
|
} : null
|
|
527
513
|
});
|
|
528
514
|
if ((0, _featureFlags().getFeatureFlag)('conditionalBundlingApi')) {
|
|
529
|
-
asset.meta.conditions = conditions.map(
|
|
530
|
-
// @ts-expect-error TS7006
|
|
531
|
-
c => ({
|
|
515
|
+
asset.meta.conditions = conditions.map(c => ({
|
|
532
516
|
key: c.key,
|
|
533
517
|
ifTruePlaceholder: c.if_true_placeholder,
|
|
534
518
|
ifFalsePlaceholder: c.if_false_placeholder
|
|
@@ -557,17 +541,12 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
557
541
|
return location;
|
|
558
542
|
};
|
|
559
543
|
if (diagnostics) {
|
|
560
|
-
let errors = diagnostics.filter(
|
|
561
|
-
|
|
562
|
-
d => d.severity === 'Error' || d.severity === 'SourceError' && asset.isSource);
|
|
563
|
-
let warnings = diagnostics.filter(
|
|
564
|
-
// @ts-expect-error TS7006
|
|
565
|
-
d => d.severity === 'Warning' || d.severity === 'SourceError' && !asset.isSource);
|
|
544
|
+
let errors = diagnostics.filter(d => d.severity === 'Error' || d.severity === 'SourceError' && asset.isSource);
|
|
545
|
+
let warnings = diagnostics.filter(d => d.severity === 'Warning' || d.severity === 'SourceError' && !asset.isSource);
|
|
566
546
|
let convertDiagnostic = diagnostic => {
|
|
567
547
|
var _diagnostic$code_high;
|
|
568
548
|
let message = diagnostic.message;
|
|
569
549
|
if (message === 'SCRIPT_ERROR') {
|
|
570
|
-
// @ts-expect-error TS7053
|
|
571
550
|
let err = SCRIPT_ERRORS[asset.env.context];
|
|
572
551
|
message = (err === null || err === void 0 ? void 0 : err.message) || SCRIPT_ERRORS.browser.message;
|
|
573
552
|
}
|
|
@@ -590,8 +569,6 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
590
569
|
codeHighlights: [(0, _diagnostic().convertSourceLocationToHighlight)(asset.env.loc, 'The environment was originally created here')]
|
|
591
570
|
});
|
|
592
571
|
}
|
|
593
|
-
|
|
594
|
-
// @ts-expect-error TS7053
|
|
595
572
|
let err = SCRIPT_ERRORS[asset.env.context];
|
|
596
573
|
if (err) {
|
|
597
574
|
if (!res.hints) {
|
|
@@ -636,7 +613,6 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
636
613
|
env: {
|
|
637
614
|
context: 'web-worker',
|
|
638
615
|
sourceType: dep.source_type === 'Module' ? 'module' : 'script',
|
|
639
|
-
// @ts-expect-error TS2322
|
|
640
616
|
outputFormat,
|
|
641
617
|
loc
|
|
642
618
|
},
|
|
@@ -740,6 +716,12 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
740
716
|
outputFormat,
|
|
741
717
|
loc: convertLoc(dep.loc)
|
|
742
718
|
};
|
|
719
|
+
if ((0, _featureFlags().getFeatureFlag)('supportWebpackChunkName')) {
|
|
720
|
+
let chunkName = magic_comments[dep.specifier];
|
|
721
|
+
if (chunkName) {
|
|
722
|
+
meta.chunkName = chunkName;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
743
725
|
}
|
|
744
726
|
|
|
745
727
|
// Always bundle helpers, even with includeNodeModules: false, except if this is a library.
|
|
@@ -759,7 +741,6 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
759
741
|
idx = dep.specifier.indexOf('/', idx + 1);
|
|
760
742
|
}
|
|
761
743
|
let module = idx >= 0 ? dep.specifier.slice(0, idx) : dep.specifier;
|
|
762
|
-
// @ts-expect-error TS7053
|
|
763
744
|
range = _package.default.dependencies[module];
|
|
764
745
|
}
|
|
765
746
|
asset.addDependency({
|
|
@@ -771,7 +752,6 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
771
752
|
meta,
|
|
772
753
|
resolveFrom: isHelper ? __filename : undefined,
|
|
773
754
|
range,
|
|
774
|
-
// @ts-expect-error TS2322
|
|
775
755
|
env
|
|
776
756
|
});
|
|
777
757
|
}
|
|
@@ -818,14 +798,11 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
818
798
|
let dep = deps.get(source);
|
|
819
799
|
if (!dep) continue;
|
|
820
800
|
if (local === '*' && imported === '*') {
|
|
821
|
-
// @ts-expect-error TS2345
|
|
822
801
|
dep.symbols.set('*', '*', convertLoc(loc), true);
|
|
823
802
|
} else {
|
|
824
803
|
var _dep$symbols$get;
|
|
825
804
|
let reExportName = ((_dep$symbols$get = dep.symbols.get(imported)) === null || _dep$symbols$get === void 0 ? void 0 : _dep$symbols$get.local) ?? `$${asset.id}$re_export$${local}`;
|
|
826
|
-
// @ts-expect-error TS2345
|
|
827
805
|
asset.symbols.set(local, reExportName);
|
|
828
|
-
// @ts-expect-error TS2345
|
|
829
806
|
dep.symbols.set(imported, reExportName, convertLoc(loc), true);
|
|
830
807
|
}
|
|
831
808
|
}
|
|
@@ -843,9 +820,7 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
843
820
|
let symbols = new Map();
|
|
844
821
|
for (let name of hoist_result.self_references) {
|
|
845
822
|
// Do not create a self-reference for the `default` symbol unless we have seen an __esModule flag.
|
|
846
|
-
if (name === 'default' &&
|
|
847
|
-
// @ts-expect-error TS2345
|
|
848
|
-
!asset.symbols.hasExportSymbol('__esModule')) {
|
|
823
|
+
if (name === 'default' && !asset.symbols.hasExportSymbol('__esModule')) {
|
|
849
824
|
continue;
|
|
850
825
|
}
|
|
851
826
|
let local = (0, _nullthrows().default)(asset.symbols.get(name)).local;
|
|
@@ -872,13 +847,10 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
872
847
|
// Add * symbol if there are CJS exports, no imports/exports at all
|
|
873
848
|
// (and the asset has side effects), or the asset is wrapped.
|
|
874
849
|
// This allows accessing symbols that don't exist without errors in symbol propagation.
|
|
875
|
-
if (hoist_result.has_cjs_exports || !hoist_result.is_esm && asset.sideEffects && deps.size === 0 && Object.keys(hoist_result.exported_symbols).length === 0 ||
|
|
876
|
-
// @ts-expect-error TS2345
|
|
877
|
-
hoist_result.should_wrap && !asset.symbols.hasExportSymbol('*')) {
|
|
850
|
+
if (hoist_result.has_cjs_exports || !hoist_result.is_esm && asset.sideEffects && deps.size === 0 && Object.keys(hoist_result.exported_symbols).length === 0 || hoist_result.should_wrap && !asset.symbols.hasExportSymbol('*')) {
|
|
878
851
|
if (is_empty_or_empty_export) {
|
|
879
852
|
asset.meta.emptyFileStarReexport = true;
|
|
880
853
|
}
|
|
881
|
-
// @ts-expect-error TS2345
|
|
882
854
|
asset.symbols.set('*', `$${asset.id}$exports`);
|
|
883
855
|
}
|
|
884
856
|
asset.meta.hasCJSExports = hoist_result.has_cjs_exports;
|
|
@@ -895,14 +867,10 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
895
867
|
source
|
|
896
868
|
} of symbol_result.exports) {
|
|
897
869
|
let dep = source ? deps.get(source) : undefined;
|
|
898
|
-
asset.symbols.set(exported,
|
|
899
|
-
// @ts-expect-error TS2345
|
|
900
|
-
`${(dep === null || dep === void 0 ? void 0 : dep.id) ?? ''}$${local}`, convertLoc(loc));
|
|
870
|
+
asset.symbols.set(exported, `${(dep === null || dep === void 0 ? void 0 : dep.id) ?? ''}$${local}`, convertLoc(loc));
|
|
901
871
|
if (dep != null) {
|
|
902
872
|
dep.symbols.ensure();
|
|
903
|
-
dep.symbols.set(local,
|
|
904
|
-
// @ts-expect-error TS2345
|
|
905
|
-
`${(dep === null || dep === void 0 ? void 0 : dep.id) ?? ''}$${local}`, convertLoc(loc), true);
|
|
873
|
+
dep.symbols.set(local, `${(dep === null || dep === void 0 ? void 0 : dep.id) ?? ''}$${local}`, convertLoc(loc), true);
|
|
906
874
|
}
|
|
907
875
|
}
|
|
908
876
|
for (let {
|
|
@@ -923,23 +891,18 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
923
891
|
let dep = deps.get(source);
|
|
924
892
|
if (!dep) continue;
|
|
925
893
|
dep.symbols.ensure();
|
|
926
|
-
// @ts-expect-error TS2345
|
|
927
894
|
dep.symbols.set('*', '*', convertLoc(loc), true);
|
|
928
895
|
}
|
|
929
896
|
|
|
930
897
|
// Add * symbol if there are CJS exports, no imports/exports at all, or the asset is wrapped.
|
|
931
898
|
// This allows accessing symbols that don't exist without errors in symbol propagation.
|
|
932
|
-
if (symbol_result.has_cjs_exports || !symbol_result.is_esm && deps.size === 0 && symbol_result.exports.length === 0 ||
|
|
933
|
-
// @ts-expect-error TS2345
|
|
934
|
-
symbol_result.should_wrap && !asset.symbols.hasExportSymbol('*')) {
|
|
899
|
+
if (symbol_result.has_cjs_exports || !symbol_result.is_esm && deps.size === 0 && symbol_result.exports.length === 0 || symbol_result.should_wrap && !asset.symbols.hasExportSymbol('*')) {
|
|
935
900
|
asset.symbols.ensure();
|
|
936
|
-
// @ts-expect-error TS2345
|
|
937
901
|
asset.symbols.set('*', `$${asset.id}$exports`);
|
|
938
902
|
}
|
|
939
903
|
} else {
|
|
940
904
|
// If the asset is wrapped, add * as a fallback
|
|
941
905
|
asset.symbols.ensure();
|
|
942
|
-
// @ts-expect-error TS2345
|
|
943
906
|
asset.symbols.set('*', `$${asset.id}$exports`);
|
|
944
907
|
}
|
|
945
908
|
|
|
@@ -948,7 +911,6 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
948
911
|
for (let dep of asset.getDependencies()) {
|
|
949
912
|
if (dep.symbols.isCleared) {
|
|
950
913
|
dep.symbols.ensure();
|
|
951
|
-
// @ts-expect-error TS2345
|
|
952
914
|
dep.symbols.set('*', `${dep.id}$`);
|
|
953
915
|
}
|
|
954
916
|
}
|
|
@@ -971,7 +933,6 @@ var _default = exports.default = new (_plugin().Transformer)({
|
|
|
971
933
|
let sourceMap = new (_sourceMap().default)(options.projectRoot);
|
|
972
934
|
sourceMap.addVLQMap(JSON.parse(map));
|
|
973
935
|
if (originalMap) {
|
|
974
|
-
// @ts-expect-error TS2345
|
|
975
936
|
sourceMap.extends(originalMap);
|
|
976
937
|
}
|
|
977
938
|
asset.setMap(sourceMap);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/transformer-js",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,12 +9,10 @@
|
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/atlassian-labs/atlaspack.git"
|
|
11
11
|
},
|
|
12
|
-
"main": "
|
|
13
|
-
"source": "
|
|
14
|
-
"types": "./lib/JSTransformer.d.ts",
|
|
12
|
+
"main": "lib/JSTransformer.js",
|
|
13
|
+
"source": "src/JSTransformer.js",
|
|
15
14
|
"scripts": {
|
|
16
|
-
"test": "mocha"
|
|
17
|
-
"check-ts": "tsc --emitDeclarationOnly --rootDir src"
|
|
15
|
+
"test": "mocha"
|
|
18
16
|
},
|
|
19
17
|
"engines": {
|
|
20
18
|
"node": ">= 16.0.0"
|
|
@@ -24,13 +22,13 @@
|
|
|
24
22
|
"src"
|
|
25
23
|
],
|
|
26
24
|
"dependencies": {
|
|
27
|
-
"@atlaspack/diagnostic": "2.14.
|
|
28
|
-
"@atlaspack/feature-flags": "2.
|
|
29
|
-
"@atlaspack/plugin": "2.14.21
|
|
30
|
-
"@atlaspack/rust": "3.4.
|
|
31
|
-
"@atlaspack/utils": "2.17.3-typescript-bc4459c37.0",
|
|
32
|
-
"@atlaspack/workers": "2.14.21-typescript-bc4459c37.0",
|
|
25
|
+
"@atlaspack/diagnostic": "2.14.1",
|
|
26
|
+
"@atlaspack/feature-flags": "2.20.0",
|
|
27
|
+
"@atlaspack/plugin": "2.14.21",
|
|
28
|
+
"@atlaspack/rust": "3.4.1",
|
|
33
29
|
"@parcel/source-map": "^2.1.1",
|
|
30
|
+
"@atlaspack/utils": "2.17.3",
|
|
31
|
+
"@atlaspack/workers": "2.14.21",
|
|
34
32
|
"@swc/helpers": "^0.5.15",
|
|
35
33
|
"browserslist": "^4.6.6",
|
|
36
34
|
"nullthrows": "^1.1.1",
|
|
@@ -40,6 +38,5 @@
|
|
|
40
38
|
"peerDependencies": {
|
|
41
39
|
"@atlaspack/core": "^2.13.1"
|
|
42
40
|
},
|
|
43
|
-
"type": "commonjs"
|
|
44
|
-
|
|
45
|
-
}
|
|
41
|
+
"type": "commonjs"
|
|
42
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
import type {
|
|
2
3
|
JSONObject,
|
|
3
4
|
EnvMap,
|
|
@@ -26,7 +27,7 @@ import {getFeatureFlag} from '@atlaspack/feature-flags';
|
|
|
26
27
|
const JSX_EXTENSIONS = {
|
|
27
28
|
jsx: true,
|
|
28
29
|
tsx: true,
|
|
29
|
-
}
|
|
30
|
+
};
|
|
30
31
|
|
|
31
32
|
const JSX_PRAGMA = {
|
|
32
33
|
react: {
|
|
@@ -49,7 +50,7 @@ const JSX_PRAGMA = {
|
|
|
49
50
|
pragmaFrag: undefined,
|
|
50
51
|
automatic: undefined,
|
|
51
52
|
},
|
|
52
|
-
}
|
|
53
|
+
};
|
|
53
54
|
|
|
54
55
|
const BROWSER_MAPPING = {
|
|
55
56
|
and_chr: 'chrome',
|
|
@@ -63,7 +64,7 @@ const BROWSER_MAPPING = {
|
|
|
63
64
|
bb: null,
|
|
64
65
|
kaios: null,
|
|
65
66
|
op_mini: null,
|
|
66
|
-
}
|
|
67
|
+
};
|
|
67
68
|
|
|
68
69
|
// List of browsers to exclude when the esmodule target is specified.
|
|
69
70
|
// Based on https://caniuse.com/#feat=es6-module
|
|
@@ -133,43 +134,45 @@ const SCRIPT_ERRORS = {
|
|
|
133
134
|
'Service workers cannot have imports or exports without the `type: "module"` option.',
|
|
134
135
|
hint: "Add {type: 'module'} as a second argument to the navigator.serviceWorker.register() call.",
|
|
135
136
|
},
|
|
136
|
-
}
|
|
137
|
+
};
|
|
137
138
|
|
|
138
139
|
type TSConfig = {
|
|
139
140
|
compilerOptions?: {
|
|
140
141
|
// https://www.typescriptlang.org/tsconfig#jsx
|
|
141
|
-
jsx?: 'react' | 'react-jsx' | 'react-jsxdev' | 'preserve' | 'react-native'
|
|
142
|
+
jsx?: 'react' | 'react-jsx' | 'react-jsxdev' | 'preserve' | 'react-native',
|
|
142
143
|
// https://www.typescriptlang.org/tsconfig#jsxFactory
|
|
143
|
-
jsxFactory?: string
|
|
144
|
+
jsxFactory?: string,
|
|
144
145
|
// https://www.typescriptlang.org/tsconfig#jsxFragmentFactory
|
|
145
|
-
jsxFragmentFactory?: string
|
|
146
|
+
jsxFragmentFactory?: string,
|
|
146
147
|
// https://www.typescriptlang.org/tsconfig#jsxImportSource
|
|
147
|
-
jsxImportSource?: string
|
|
148
|
+
jsxImportSource?: string,
|
|
148
149
|
// https://www.typescriptlang.org/tsconfig#experimentalDecorators
|
|
149
|
-
experimentalDecorators?: boolean
|
|
150
|
+
experimentalDecorators?: boolean,
|
|
150
151
|
// https://www.typescriptlang.org/tsconfig#useDefineForClassFields
|
|
151
|
-
useDefineForClassFields?: boolean
|
|
152
|
+
useDefineForClassFields?: boolean,
|
|
152
153
|
// https://www.typescriptlang.org/tsconfig#target
|
|
153
|
-
target?: string
|
|
154
|
-
|
|
154
|
+
target?: string, // 'es3' | 'es5' | 'es6' | 'es2015' | ... |'es2022' | ... | 'esnext'
|
|
155
|
+
...
|
|
156
|
+
},
|
|
157
|
+
...
|
|
155
158
|
};
|
|
156
159
|
|
|
157
|
-
type MacroAsset = {
|
|
158
|
-
type: string
|
|
159
|
-
content: string
|
|
160
|
-
};
|
|
160
|
+
type MacroAsset = {|
|
|
161
|
+
type: string,
|
|
162
|
+
content: string,
|
|
163
|
+
|};
|
|
161
164
|
|
|
162
165
|
// NOTE: Make sure this is in sync with the TypeScript definition in the @atlaspack/macros package.
|
|
163
|
-
type MacroContext = {
|
|
164
|
-
addAsset(asset: MacroAsset): void
|
|
165
|
-
invalidateOnFileChange(
|
|
166
|
-
invalidateOnFileCreate(
|
|
167
|
-
invalidateOnEnvChange(
|
|
168
|
-
invalidateOnStartup(): void
|
|
169
|
-
invalidateOnBuild(): void
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
export default new Transformer({
|
|
166
|
+
type MacroContext = {|
|
|
167
|
+
addAsset(asset: MacroAsset): void,
|
|
168
|
+
invalidateOnFileChange(FilePath): void,
|
|
169
|
+
invalidateOnFileCreate(FileCreateInvalidation): void,
|
|
170
|
+
invalidateOnEnvChange(string): void,
|
|
171
|
+
invalidateOnStartup(): void,
|
|
172
|
+
invalidateOnBuild(): void,
|
|
173
|
+
|};
|
|
174
|
+
|
|
175
|
+
export default (new Transformer({
|
|
173
176
|
async loadConfig({config, options}) {
|
|
174
177
|
let packageJson = await config.getPackage();
|
|
175
178
|
let isJSX,
|
|
@@ -217,11 +220,9 @@ export default new Transformer({
|
|
|
217
220
|
// Use explicitly defined JSX options in tsconfig.json over inferred values from dependencies.
|
|
218
221
|
pragma =
|
|
219
222
|
compilerOptions?.jsxFactory ||
|
|
220
|
-
// @ts-expect-error TS7053
|
|
221
223
|
(reactLib ? JSX_PRAGMA[reactLib].pragma : undefined);
|
|
222
224
|
pragmaFrag =
|
|
223
225
|
compilerOptions?.jsxFragmentFactory ||
|
|
224
|
-
// @ts-expect-error TS7053
|
|
225
226
|
(reactLib ? JSX_PRAGMA[reactLib].pragmaFrag : undefined);
|
|
226
227
|
|
|
227
228
|
if (
|
|
@@ -236,20 +237,17 @@ export default new Transformer({
|
|
|
236
237
|
packageJson?.alias && packageJson.alias['react'] === 'preact/compat'
|
|
237
238
|
? 'preact'
|
|
238
239
|
: reactLib;
|
|
239
|
-
// @ts-expect-error TS7053
|
|
240
240
|
let automaticVersion = JSX_PRAGMA[effectiveReactLib]?.automatic;
|
|
241
241
|
let reactLibVersion =
|
|
242
242
|
packageJson?.dependencies?.[effectiveReactLib] ||
|
|
243
243
|
packageJson?.devDependencies?.[effectiveReactLib] ||
|
|
244
244
|
packageJson?.peerDependencies?.[effectiveReactLib];
|
|
245
|
-
// @ts-expect-error TS2322
|
|
246
245
|
reactLibVersion = reactLibVersion
|
|
247
246
|
? semver.validRange(reactLibVersion)
|
|
248
247
|
: null;
|
|
249
248
|
let minReactLibVersion =
|
|
250
249
|
reactLibVersion !== null && reactLibVersion !== '*'
|
|
251
|
-
?
|
|
252
|
-
semver.minVersion(reactLibVersion)?.toString()
|
|
250
|
+
? semver.minVersion(reactLibVersion)?.toString()
|
|
253
251
|
: null;
|
|
254
252
|
|
|
255
253
|
automaticJSXRuntime =
|
|
@@ -314,14 +312,10 @@ export default new Transformer({
|
|
|
314
312
|
'Invalid config for @atlaspack/transformer-js',
|
|
315
313
|
);
|
|
316
314
|
|
|
317
|
-
// @ts-expect-error TS2339
|
|
318
315
|
magicComments = conf.contents?.magicComments ?? magicComments;
|
|
319
|
-
// @ts-expect-error TS2339
|
|
320
316
|
inlineEnvironment = conf.contents?.inlineEnvironment ?? inlineEnvironment;
|
|
321
|
-
// @ts-expect-error TS2339
|
|
322
317
|
inlineFS = conf.contents?.inlineFS ?? inlineFS;
|
|
323
318
|
inlineConstants =
|
|
324
|
-
// @ts-expect-error TS2339
|
|
325
319
|
conf.contents?.unstable_inlineConstants ?? inlineConstants;
|
|
326
320
|
}
|
|
327
321
|
|
|
@@ -368,7 +362,6 @@ export default new Transformer({
|
|
|
368
362
|
for (let browser of browsers) {
|
|
369
363
|
let [name, version] = browser.split(' ');
|
|
370
364
|
if (BROWSER_MAPPING.hasOwnProperty(name)) {
|
|
371
|
-
// @ts-expect-error TS7053
|
|
372
365
|
name = BROWSER_MAPPING[name];
|
|
373
366
|
if (!name) {
|
|
374
367
|
continue;
|
|
@@ -378,15 +371,12 @@ export default new Transformer({
|
|
|
378
371
|
let [major, minor = '0', patch = '0'] = version
|
|
379
372
|
.split('-')[0]
|
|
380
373
|
.split('.');
|
|
381
|
-
// @ts-expect-error TS2345
|
|
382
374
|
if (isNaN(major) || isNaN(minor) || isNaN(patch)) {
|
|
383
375
|
continue;
|
|
384
376
|
}
|
|
385
377
|
let semverVersion = `${major}.${minor}.${patch}`;
|
|
386
378
|
|
|
387
|
-
// @ts-expect-error TS2345
|
|
388
379
|
if (targets[name] == null || semver.gt(targets[name], semverVersion)) {
|
|
389
|
-
// @ts-expect-error TS7053
|
|
390
380
|
targets[name] = semverVersion;
|
|
391
381
|
}
|
|
392
382
|
}
|
|
@@ -396,6 +386,7 @@ export default new Transformer({
|
|
|
396
386
|
|
|
397
387
|
let env: EnvMap = {};
|
|
398
388
|
|
|
389
|
+
// $FlowFixMe
|
|
399
390
|
if (!config?.inlineEnvironment) {
|
|
400
391
|
if (options.env.NODE_ENV != null) {
|
|
401
392
|
env.NODE_ENV = options.env.NODE_ENV;
|
|
@@ -407,6 +398,7 @@ export default new Transformer({
|
|
|
407
398
|
} else if (Array.isArray(config?.inlineEnvironment)) {
|
|
408
399
|
for (let match of globMatch(
|
|
409
400
|
Object.keys(options.env),
|
|
401
|
+
// $FlowFixMe
|
|
410
402
|
config.inlineEnvironment,
|
|
411
403
|
)) {
|
|
412
404
|
env[match] = String(options.env[match]);
|
|
@@ -421,56 +413,39 @@ export default new Transformer({
|
|
|
421
413
|
|
|
422
414
|
let supportsModuleWorkers =
|
|
423
415
|
asset.env.shouldScopeHoist && asset.env.supports('worker-module', true);
|
|
416
|
+
// $FlowFixMe
|
|
424
417
|
let isJSX = Boolean(config?.isJSX);
|
|
425
418
|
if (asset.isSource) {
|
|
426
419
|
if (asset.type === 'ts') {
|
|
427
420
|
isJSX = false;
|
|
428
421
|
} else if (!isJSX) {
|
|
429
|
-
// @ts-expect-error TS7053
|
|
430
422
|
isJSX = Boolean(JSX_EXTENSIONS[asset.type]);
|
|
431
423
|
}
|
|
432
424
|
}
|
|
433
425
|
|
|
434
|
-
let macroAssets
|
|
435
|
-
content: string;
|
|
436
|
-
// @ts-expect-error TS2552
|
|
437
|
-
map: undefined | NodeSourceMap;
|
|
438
|
-
type: string;
|
|
439
|
-
uniqueKey: string;
|
|
440
|
-
}> = [];
|
|
426
|
+
let macroAssets = [];
|
|
441
427
|
let {
|
|
442
|
-
// @ts-expect-error TS2339
|
|
443
428
|
dependencies,
|
|
444
|
-
// @ts-expect-error TS2339
|
|
445
429
|
code: compiledCode,
|
|
446
|
-
// @ts-expect-error TS2339
|
|
447
430
|
map,
|
|
448
|
-
// @ts-expect-error TS2339
|
|
449
431
|
shebang,
|
|
450
|
-
// @ts-expect-error TS2339
|
|
451
432
|
hoist_result,
|
|
452
|
-
// @ts-expect-error TS2339
|
|
453
433
|
symbol_result,
|
|
454
|
-
// @ts-expect-error TS2339
|
|
455
434
|
is_empty_or_empty_export,
|
|
456
|
-
// @ts-expect-error TS2339
|
|
457
435
|
needs_esm_helpers,
|
|
458
|
-
// @ts-expect-error TS2339
|
|
459
436
|
diagnostics,
|
|
460
|
-
// @ts-expect-error TS2339
|
|
461
437
|
used_env,
|
|
462
|
-
// @ts-expect-error TS2339
|
|
463
438
|
has_node_replacements,
|
|
464
|
-
// @ts-expect-error TS2339
|
|
465
439
|
is_constant_module,
|
|
466
|
-
// @ts-expect-error TS2339
|
|
467
440
|
conditions,
|
|
441
|
+
magic_comments,
|
|
468
442
|
} = await (transformAsync || transform)({
|
|
469
443
|
filename: asset.filePath,
|
|
470
444
|
code,
|
|
471
445
|
module_id: asset.id,
|
|
472
446
|
project_root: options.projectRoot,
|
|
473
447
|
replace_env: !asset.env.isNode(),
|
|
448
|
+
// $FlowFixMe
|
|
474
449
|
inline_fs: Boolean(config?.inlineFS) && !asset.env.isNode(),
|
|
475
450
|
insert_node_globals:
|
|
476
451
|
!asset.env.isNode() && asset.env.sourceType !== 'script',
|
|
@@ -480,9 +455,13 @@ export default new Transformer({
|
|
|
480
455
|
env,
|
|
481
456
|
is_type_script: asset.type === 'ts' || asset.type === 'tsx',
|
|
482
457
|
is_jsx: isJSX,
|
|
458
|
+
// $FlowFixMe
|
|
483
459
|
jsx_pragma: config?.pragma,
|
|
460
|
+
// $FlowFixMe
|
|
484
461
|
jsx_pragma_frag: config?.pragmaFrag,
|
|
462
|
+
// $FlowFixMe
|
|
485
463
|
automatic_jsx_runtime: Boolean(config?.automaticJSXRuntime),
|
|
464
|
+
// $FlowFixMe
|
|
486
465
|
jsx_import_source: config?.jsxImportSource,
|
|
487
466
|
is_development: options.mode === 'development',
|
|
488
467
|
react_refresh:
|
|
@@ -490,8 +469,11 @@ export default new Transformer({
|
|
|
490
469
|
!asset.env.isLibrary &&
|
|
491
470
|
!asset.env.isWorker() &&
|
|
492
471
|
!asset.env.isWorklet() &&
|
|
472
|
+
// $FlowFixMe
|
|
493
473
|
Boolean(config?.reactRefresh),
|
|
474
|
+
// $FlowFixMe
|
|
494
475
|
decorators: Boolean(config?.decorators),
|
|
476
|
+
// $FlowFixMe
|
|
495
477
|
use_define_for_class_fields: Boolean(config?.useDefineForClassFields),
|
|
496
478
|
targets,
|
|
497
479
|
source_maps: !!asset.env.sourceMap,
|
|
@@ -504,13 +486,17 @@ export default new Transformer({
|
|
|
504
486
|
trace_bailouts: options.logLevel === 'verbose',
|
|
505
487
|
is_swc_helpers: /@swc[/\\]helpers/.test(asset.filePath),
|
|
506
488
|
standalone: asset.query.has('standalone'),
|
|
489
|
+
// $FlowFixMe
|
|
507
490
|
inline_constants: config.inlineConstants,
|
|
508
491
|
conditional_bundling: options.featureFlags.conditionalBundlingApi,
|
|
509
492
|
hmr_improvements: options.featureFlags.hmrImprovements,
|
|
510
493
|
computed_properties_fix: options.featureFlags.unusedComputedPropertyFix,
|
|
511
|
-
magic_comments:
|
|
494
|
+
magic_comments:
|
|
495
|
+
// $FlowFixMe
|
|
496
|
+
Boolean(config?.magicComments) ||
|
|
497
|
+
getFeatureFlag('supportWebpackChunkName'),
|
|
512
498
|
callMacro: asset.isSource
|
|
513
|
-
? async (err
|
|
499
|
+
? async (err, src, exportName, args, loc) => {
|
|
514
500
|
let mod;
|
|
515
501
|
try {
|
|
516
502
|
mod = await options.packageManager.require(src, asset.filePath);
|
|
@@ -519,6 +505,7 @@ export default new Transformer({
|
|
|
519
505
|
if (
|
|
520
506
|
exportName === 'default' &&
|
|
521
507
|
!mod.__esModule &&
|
|
508
|
+
// $FlowFixMe
|
|
522
509
|
Object.prototype.toString.call(config) !== '[object Module]'
|
|
523
510
|
) {
|
|
524
511
|
mod = {default: mod};
|
|
@@ -527,7 +514,7 @@ export default new Transformer({
|
|
|
527
514
|
if (!Object.hasOwnProperty.call(mod, exportName)) {
|
|
528
515
|
throw new Error(`"${src}" does not export "${exportName}".`);
|
|
529
516
|
}
|
|
530
|
-
} catch (err
|
|
517
|
+
} catch (err) {
|
|
531
518
|
throw {
|
|
532
519
|
kind: 1,
|
|
533
520
|
message: err.message,
|
|
@@ -544,8 +531,7 @@ export default new Transformer({
|
|
|
544
531
|
if (asset.env.sourceMap) {
|
|
545
532
|
// Generate a source map that maps each line of the asset to the original macro call.
|
|
546
533
|
map = new SourceMap(options.projectRoot);
|
|
547
|
-
|
|
548
|
-
let mappings: Array<IndexedMapping<string>> = [];
|
|
534
|
+
let mappings = [];
|
|
549
535
|
let line = 1;
|
|
550
536
|
for (let i = 0; i <= a.content.length; i++) {
|
|
551
537
|
if (i === a.content.length || a.content[i] === '\n') {
|
|
@@ -566,7 +552,6 @@ export default new Transformer({
|
|
|
566
552
|
|
|
567
553
|
map.addIndexedMappings(mappings);
|
|
568
554
|
if (originalMap) {
|
|
569
|
-
// @ts-expect-error TS2345
|
|
570
555
|
map.extends(originalMap);
|
|
571
556
|
} else {
|
|
572
557
|
map.setSourceContent(asset.filePath, code.toString());
|
|
@@ -585,13 +570,13 @@ export default new Transformer({
|
|
|
585
570
|
specifierType: 'esm',
|
|
586
571
|
});
|
|
587
572
|
},
|
|
588
|
-
invalidateOnFileChange(filePath
|
|
573
|
+
invalidateOnFileChange(filePath) {
|
|
589
574
|
asset.invalidateOnFileChange(filePath);
|
|
590
575
|
},
|
|
591
|
-
invalidateOnFileCreate(invalidation
|
|
576
|
+
invalidateOnFileCreate(invalidation) {
|
|
592
577
|
asset.invalidateOnFileCreate(invalidation);
|
|
593
578
|
},
|
|
594
|
-
invalidateOnEnvChange(env
|
|
579
|
+
invalidateOnEnvChange(env) {
|
|
595
580
|
asset.invalidateOnEnvChange(env);
|
|
596
581
|
},
|
|
597
582
|
invalidateOnStartup() {
|
|
@@ -608,7 +593,7 @@ export default new Transformer({
|
|
|
608
593
|
`"${exportName}" in "${src}" is not a function.`,
|
|
609
594
|
);
|
|
610
595
|
}
|
|
611
|
-
} catch (err
|
|
596
|
+
} catch (err) {
|
|
612
597
|
// Remove atlaspack core from stack and build string so Rust can process errors more easily.
|
|
613
598
|
let stack = (err.stack || '').split('\n').slice(1);
|
|
614
599
|
let message = err.message;
|
|
@@ -628,21 +613,18 @@ export default new Transformer({
|
|
|
628
613
|
});
|
|
629
614
|
|
|
630
615
|
if (getFeatureFlag('conditionalBundlingApi')) {
|
|
631
|
-
asset.meta.conditions = conditions.map(
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
ifFalsePlaceholder: c.if_false_placeholder,
|
|
637
|
-
}),
|
|
638
|
-
);
|
|
616
|
+
asset.meta.conditions = conditions.map((c): ConditionMeta => ({
|
|
617
|
+
key: c.key,
|
|
618
|
+
ifTruePlaceholder: c.if_true_placeholder,
|
|
619
|
+
ifFalsePlaceholder: c.if_false_placeholder,
|
|
620
|
+
}));
|
|
639
621
|
}
|
|
640
622
|
|
|
641
623
|
if (is_constant_module) {
|
|
642
624
|
asset.meta.isConstantModule = true;
|
|
643
625
|
}
|
|
644
626
|
|
|
645
|
-
let convertLoc = (loc
|
|
627
|
+
let convertLoc = (loc): SourceLocation => {
|
|
646
628
|
let location = {
|
|
647
629
|
filePath: asset.filePath,
|
|
648
630
|
start: {
|
|
@@ -665,22 +647,19 @@ export default new Transformer({
|
|
|
665
647
|
|
|
666
648
|
if (diagnostics) {
|
|
667
649
|
let errors = diagnostics.filter(
|
|
668
|
-
// @ts-expect-error TS7006
|
|
669
650
|
(d) =>
|
|
670
651
|
d.severity === 'Error' ||
|
|
671
652
|
(d.severity === 'SourceError' && asset.isSource),
|
|
672
653
|
);
|
|
673
654
|
let warnings = diagnostics.filter(
|
|
674
|
-
// @ts-expect-error TS7006
|
|
675
655
|
(d) =>
|
|
676
656
|
d.severity === 'Warning' ||
|
|
677
657
|
(d.severity === 'SourceError' && !asset.isSource),
|
|
678
658
|
);
|
|
679
|
-
let convertDiagnostic = (diagnostic
|
|
659
|
+
let convertDiagnostic = (diagnostic) => {
|
|
680
660
|
let message = diagnostic.message;
|
|
681
661
|
if (message === 'SCRIPT_ERROR') {
|
|
682
|
-
|
|
683
|
-
let err = SCRIPT_ERRORS[asset.env.context as string];
|
|
662
|
+
let err = SCRIPT_ERRORS[(asset.env.context: string)];
|
|
684
663
|
message = err?.message || SCRIPT_ERRORS.browser.message;
|
|
685
664
|
}
|
|
686
665
|
|
|
@@ -689,12 +668,11 @@ export default new Transformer({
|
|
|
689
668
|
codeFrames: [
|
|
690
669
|
{
|
|
691
670
|
filePath: asset.filePath,
|
|
692
|
-
codeHighlights: diagnostic.code_highlights?.map(
|
|
693
|
-
(
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
),
|
|
671
|
+
codeHighlights: diagnostic.code_highlights?.map((highlight) =>
|
|
672
|
+
convertSourceLocationToHighlight(
|
|
673
|
+
convertLoc(highlight.loc),
|
|
674
|
+
highlight.message ?? undefined,
|
|
675
|
+
),
|
|
698
676
|
),
|
|
699
677
|
},
|
|
700
678
|
],
|
|
@@ -718,8 +696,7 @@ export default new Transformer({
|
|
|
718
696
|
});
|
|
719
697
|
}
|
|
720
698
|
|
|
721
|
-
|
|
722
|
-
let err = SCRIPT_ERRORS[asset.env.context as string];
|
|
699
|
+
let err = SCRIPT_ERRORS[(asset.env.context: string)];
|
|
723
700
|
if (err) {
|
|
724
701
|
if (!res.hints) {
|
|
725
702
|
res.hints = [err.hint];
|
|
@@ -776,7 +753,6 @@ export default new Transformer({
|
|
|
776
753
|
env: {
|
|
777
754
|
context: 'web-worker',
|
|
778
755
|
sourceType: dep.source_type === 'Module' ? 'module' : 'script',
|
|
779
|
-
// @ts-expect-error TS2322
|
|
780
756
|
outputFormat,
|
|
781
757
|
loc,
|
|
782
758
|
},
|
|
@@ -894,6 +870,13 @@ export default new Transformer({
|
|
|
894
870
|
outputFormat,
|
|
895
871
|
loc: convertLoc(dep.loc),
|
|
896
872
|
};
|
|
873
|
+
|
|
874
|
+
if (getFeatureFlag('supportWebpackChunkName')) {
|
|
875
|
+
let chunkName = magic_comments[dep.specifier];
|
|
876
|
+
if (chunkName) {
|
|
877
|
+
meta.chunkName = chunkName;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
897
880
|
}
|
|
898
881
|
|
|
899
882
|
// Always bundle helpers, even with includeNodeModules: false, except if this is a library.
|
|
@@ -918,7 +901,6 @@ export default new Transformer({
|
|
|
918
901
|
idx = dep.specifier.indexOf('/', idx + 1);
|
|
919
902
|
}
|
|
920
903
|
let module = idx >= 0 ? dep.specifier.slice(0, idx) : dep.specifier;
|
|
921
|
-
// @ts-expect-error TS7053
|
|
922
904
|
range = pkg.dependencies[module];
|
|
923
905
|
}
|
|
924
906
|
|
|
@@ -930,13 +912,12 @@ export default new Transformer({
|
|
|
930
912
|
dep.kind === 'DynamicImport'
|
|
931
913
|
? 'lazy'
|
|
932
914
|
: dep.kind === 'ConditionalImport'
|
|
933
|
-
|
|
934
|
-
|
|
915
|
+
? 'conditional'
|
|
916
|
+
: 'sync',
|
|
935
917
|
isOptional: dep.is_optional,
|
|
936
918
|
meta,
|
|
937
919
|
resolveFrom: isHelper ? __filename : undefined,
|
|
938
920
|
range,
|
|
939
|
-
// @ts-expect-error TS2322
|
|
940
921
|
env,
|
|
941
922
|
});
|
|
942
923
|
}
|
|
@@ -983,15 +964,12 @@ export default new Transformer({
|
|
|
983
964
|
let dep = deps.get(source);
|
|
984
965
|
if (!dep) continue;
|
|
985
966
|
if (local === '*' && imported === '*') {
|
|
986
|
-
// @ts-expect-error TS2345
|
|
987
967
|
dep.symbols.set('*', '*', convertLoc(loc), true);
|
|
988
968
|
} else {
|
|
989
969
|
let reExportName =
|
|
990
970
|
dep.symbols.get(imported)?.local ??
|
|
991
971
|
`$${asset.id}$re_export$${local}`;
|
|
992
|
-
// @ts-expect-error TS2345
|
|
993
972
|
asset.symbols.set(local, reExportName);
|
|
994
|
-
// @ts-expect-error TS2345
|
|
995
973
|
dep.symbols.set(imported, reExportName, convertLoc(loc), true);
|
|
996
974
|
}
|
|
997
975
|
}
|
|
@@ -1014,7 +992,6 @@ export default new Transformer({
|
|
|
1014
992
|
// Do not create a self-reference for the `default` symbol unless we have seen an __esModule flag.
|
|
1015
993
|
if (
|
|
1016
994
|
name === 'default' &&
|
|
1017
|
-
// @ts-expect-error TS2345
|
|
1018
995
|
!asset.symbols.hasExportSymbol('__esModule')
|
|
1019
996
|
) {
|
|
1020
997
|
continue;
|
|
@@ -1050,13 +1027,11 @@ export default new Transformer({
|
|
|
1050
1027
|
asset.sideEffects &&
|
|
1051
1028
|
deps.size === 0 &&
|
|
1052
1029
|
Object.keys(hoist_result.exported_symbols).length === 0) ||
|
|
1053
|
-
// @ts-expect-error TS2345
|
|
1054
1030
|
(hoist_result.should_wrap && !asset.symbols.hasExportSymbol('*'))
|
|
1055
1031
|
) {
|
|
1056
1032
|
if (is_empty_or_empty_export) {
|
|
1057
1033
|
asset.meta.emptyFileStarReexport = true;
|
|
1058
1034
|
}
|
|
1059
|
-
// @ts-expect-error TS2345
|
|
1060
1035
|
asset.symbols.set('*', `$${asset.id}$exports`);
|
|
1061
1036
|
}
|
|
1062
1037
|
|
|
@@ -1076,7 +1051,6 @@ export default new Transformer({
|
|
|
1076
1051
|
let dep = source ? deps.get(source) : undefined;
|
|
1077
1052
|
asset.symbols.set(
|
|
1078
1053
|
exported,
|
|
1079
|
-
// @ts-expect-error TS2345
|
|
1080
1054
|
`${dep?.id ?? ''}$${local}`,
|
|
1081
1055
|
convertLoc(loc),
|
|
1082
1056
|
);
|
|
@@ -1084,7 +1058,6 @@ export default new Transformer({
|
|
|
1084
1058
|
dep.symbols.ensure();
|
|
1085
1059
|
dep.symbols.set(
|
|
1086
1060
|
local,
|
|
1087
|
-
// @ts-expect-error TS2345
|
|
1088
1061
|
`${dep?.id ?? ''}$${local}`,
|
|
1089
1062
|
convertLoc(loc),
|
|
1090
1063
|
true,
|
|
@@ -1103,7 +1076,6 @@ export default new Transformer({
|
|
|
1103
1076
|
let dep = deps.get(source);
|
|
1104
1077
|
if (!dep) continue;
|
|
1105
1078
|
dep.symbols.ensure();
|
|
1106
|
-
// @ts-expect-error TS2345
|
|
1107
1079
|
dep.symbols.set('*', '*', convertLoc(loc), true);
|
|
1108
1080
|
}
|
|
1109
1081
|
|
|
@@ -1114,17 +1086,14 @@ export default new Transformer({
|
|
|
1114
1086
|
(!symbol_result.is_esm &&
|
|
1115
1087
|
deps.size === 0 &&
|
|
1116
1088
|
symbol_result.exports.length === 0) ||
|
|
1117
|
-
// @ts-expect-error TS2345
|
|
1118
1089
|
(symbol_result.should_wrap && !asset.symbols.hasExportSymbol('*'))
|
|
1119
1090
|
) {
|
|
1120
1091
|
asset.symbols.ensure();
|
|
1121
|
-
// @ts-expect-error TS2345
|
|
1122
1092
|
asset.symbols.set('*', `$${asset.id}$exports`);
|
|
1123
1093
|
}
|
|
1124
1094
|
} else {
|
|
1125
1095
|
// If the asset is wrapped, add * as a fallback
|
|
1126
1096
|
asset.symbols.ensure();
|
|
1127
|
-
// @ts-expect-error TS2345
|
|
1128
1097
|
asset.symbols.set('*', `$${asset.id}$exports`);
|
|
1129
1098
|
}
|
|
1130
1099
|
|
|
@@ -1133,7 +1102,6 @@ export default new Transformer({
|
|
|
1133
1102
|
for (let dep of asset.getDependencies()) {
|
|
1134
1103
|
if (dep.symbols.isCleared) {
|
|
1135
1104
|
dep.symbols.ensure();
|
|
1136
|
-
// @ts-expect-error TS2345
|
|
1137
1105
|
dep.symbols.set('*', `${dep.id}$`);
|
|
1138
1106
|
}
|
|
1139
1107
|
}
|
|
@@ -1159,7 +1127,6 @@ export default new Transformer({
|
|
|
1159
1127
|
let sourceMap = new SourceMap(options.projectRoot);
|
|
1160
1128
|
sourceMap.addVLQMap(JSON.parse(map));
|
|
1161
1129
|
if (originalMap) {
|
|
1162
|
-
// @ts-expect-error TS2345
|
|
1163
1130
|
sourceMap.extends(originalMap);
|
|
1164
1131
|
}
|
|
1165
1132
|
asset.setMap(sourceMap);
|
|
@@ -1167,4 +1134,4 @@ export default new Transformer({
|
|
|
1167
1134
|
|
|
1168
1135
|
return [asset, ...macroAssets];
|
|
1169
1136
|
},
|
|
1170
|
-
})
|
|
1137
|
+
}): Transformer<mixed>);
|
package/LICENSE
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright (c) 2024 Atlassian US., Inc.
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
package/lib/JSTransformer.d.ts
DELETED