@atlaspack/packager-js 2.14.5-canary.99 → 2.14.5-dev.1c70d50f9.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -12
- package/lib/ScopeHoistingPackager.js +2 -27
- package/package.json +9 -10
- package/src/ScopeHoistingPackager.js +2 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
# @atlaspack/packager-js
|
|
2
2
|
|
|
3
|
-
## 2.16.2
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- [#654](https://github.com/atlassian-labs/atlaspack/pull/654) [`4d7abde`](https://github.com/atlassian-labs/atlaspack/commit/4d7abde0a6faa148bcf330b08d820f171f853b76) Thanks [@marcins](https://github.com/marcins)! - Fixes constant inlining to work correctly with scope hoisting optimisations
|
|
8
|
-
|
|
9
|
-
- Updated dependencies [[`5ded263`](https://github.com/atlassian-labs/atlaspack/commit/5ded263c7f11b866e8885b81c73e20dd060b25be)]:
|
|
10
|
-
- @atlaspack/feature-flags@2.18.3
|
|
11
|
-
- @atlaspack/utils@2.15.3
|
|
12
|
-
- @atlaspack/types@2.15.5
|
|
13
|
-
- @atlaspack/plugin@2.14.15
|
|
14
|
-
|
|
15
3
|
## 2.16.1
|
|
16
4
|
|
|
17
5
|
### Patch Changes
|
|
@@ -60,13 +60,6 @@ function _featureFlags() {
|
|
|
60
60
|
};
|
|
61
61
|
return data;
|
|
62
62
|
}
|
|
63
|
-
function _outdent() {
|
|
64
|
-
const data = require("outdent");
|
|
65
|
-
_outdent = function () {
|
|
66
|
-
return data;
|
|
67
|
-
};
|
|
68
|
-
return data;
|
|
69
|
-
}
|
|
70
63
|
var _ESMOutputFormat = require("./ESMOutputFormat");
|
|
71
64
|
var _CJSOutputFormat = require("./CJSOutputFormat");
|
|
72
65
|
var _GlobalOutputFormat = require("./GlobalOutputFormat");
|
|
@@ -438,9 +431,6 @@ class ScopeHoistingPackager {
|
|
|
438
431
|
} = (0, _nullthrows().default)(this.assetOutputs.get(asset.id));
|
|
439
432
|
return this.buildAsset(asset, code, map);
|
|
440
433
|
}
|
|
441
|
-
getAssetFilePath(asset) {
|
|
442
|
-
return _path().default.relative(this.options.projectRoot, asset.filePath);
|
|
443
|
-
}
|
|
444
434
|
buildAsset(asset, code, map) {
|
|
445
435
|
let shouldWrap = this.wrappedAssets.has(asset.id);
|
|
446
436
|
let deps = this.bundleGraph.getDependencies(asset);
|
|
@@ -538,19 +528,8 @@ class ScopeHoistingPackager {
|
|
|
538
528
|
if ((0, _featureFlags().getFeatureFlag)('applyScopeHoistingImprovement')) {
|
|
539
529
|
if (!resolved.meta.isConstantModule && !this.wrappedAssets.has(resolved.id)) {
|
|
540
530
|
let [depCode, depMap, depLines] = this.visitAsset(resolved);
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
res = (0, _outdent().outdent)`
|
|
544
|
-
/* Scope hoisted asset: ${resolvedPath} */
|
|
545
|
-
${depCode}
|
|
546
|
-
/* End: ${resolvedPath} */
|
|
547
|
-
${res}
|
|
548
|
-
`;
|
|
549
|
-
lines += 3 + depLines;
|
|
550
|
-
} else {
|
|
551
|
-
res = depCode + '\n' + res;
|
|
552
|
-
lines += 1 + depLines;
|
|
553
|
-
}
|
|
531
|
+
res = depCode + '\n' + res;
|
|
532
|
+
lines += 1 + depLines;
|
|
554
533
|
map = depMap;
|
|
555
534
|
}
|
|
556
535
|
} else {
|
|
@@ -608,10 +587,6 @@ ${code}
|
|
|
608
587
|
});
|
|
609
588
|
`;
|
|
610
589
|
lineCount += 2;
|
|
611
|
-
if (_utils().debugTools['asset-file-names-in-output']) {
|
|
612
|
-
code = `/* ${this.getAssetFilePath(asset)} */\n` + code;
|
|
613
|
-
lineCount += 1;
|
|
614
|
-
}
|
|
615
590
|
for (let [depCode, map, lines] of depContent) {
|
|
616
591
|
if (!depCode) continue;
|
|
617
592
|
code += depCode + '\n';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/packager-js",
|
|
3
|
-
"version": "2.14.5-
|
|
3
|
+
"version": "2.14.5-dev.1c70d50f9.99+1c70d50f9",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,17 +15,16 @@
|
|
|
15
15
|
"node": ">= 16.0.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@atlaspack/diagnostic": "2.14.1-
|
|
19
|
-
"@atlaspack/feature-flags": "2.14.1-
|
|
20
|
-
"@atlaspack/plugin": "2.14.5-
|
|
21
|
-
"@atlaspack/rust": "3.2.1-
|
|
22
|
-
"@atlaspack/types": "2.14.5-
|
|
23
|
-
"@atlaspack/utils": "2.14.5-
|
|
18
|
+
"@atlaspack/diagnostic": "2.14.1-dev.1c70d50f9.167+1c70d50f9",
|
|
19
|
+
"@atlaspack/feature-flags": "2.14.1-dev.1c70d50f9.167+1c70d50f9",
|
|
20
|
+
"@atlaspack/plugin": "2.14.5-dev.1c70d50f9.99+1c70d50f9",
|
|
21
|
+
"@atlaspack/rust": "3.2.1-dev.1c70d50f9.99+1c70d50f9",
|
|
22
|
+
"@atlaspack/types": "2.14.5-dev.1c70d50f9.99+1c70d50f9",
|
|
23
|
+
"@atlaspack/utils": "2.14.5-dev.1c70d50f9.99+1c70d50f9",
|
|
24
24
|
"@parcel/source-map": "^2.1.1",
|
|
25
25
|
"globals": "^13.2.0",
|
|
26
|
-
"nullthrows": "^1.1.1"
|
|
27
|
-
"outdent": "^0.8.0"
|
|
26
|
+
"nullthrows": "^1.1.1"
|
|
28
27
|
},
|
|
29
28
|
"type": "commonjs",
|
|
30
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "1c70d50f914cb662515b0b61053e51a06f3af234"
|
|
31
30
|
}
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
relativeBundlePath,
|
|
16
16
|
countLines,
|
|
17
17
|
normalizeSeparators,
|
|
18
|
-
debugTools,
|
|
19
18
|
} from '@atlaspack/utils';
|
|
20
19
|
import SourceMap from '@parcel/source-map';
|
|
21
20
|
import nullthrows from 'nullthrows';
|
|
@@ -26,7 +25,6 @@ import ThrowableDiagnostic, {
|
|
|
26
25
|
import globals from 'globals';
|
|
27
26
|
import path from 'path';
|
|
28
27
|
import {getFeatureFlag} from '@atlaspack/feature-flags';
|
|
29
|
-
import {outdent} from 'outdent';
|
|
30
28
|
|
|
31
29
|
import {ESMOutputFormat} from './ESMOutputFormat';
|
|
32
30
|
import {CJSOutputFormat} from './CJSOutputFormat';
|
|
@@ -581,10 +579,6 @@ export class ScopeHoistingPackager {
|
|
|
581
579
|
return this.buildAsset(asset, code, map);
|
|
582
580
|
}
|
|
583
581
|
|
|
584
|
-
getAssetFilePath(asset: Asset): string {
|
|
585
|
-
return path.relative(this.options.projectRoot, asset.filePath);
|
|
586
|
-
}
|
|
587
|
-
|
|
588
582
|
buildAsset(
|
|
589
583
|
asset: Asset,
|
|
590
584
|
code: string,
|
|
@@ -726,19 +720,8 @@ export class ScopeHoistingPackager {
|
|
|
726
720
|
) {
|
|
727
721
|
let [depCode, depMap, depLines] =
|
|
728
722
|
this.visitAsset(resolved);
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
res = outdent`
|
|
732
|
-
/* Scope hoisted asset: ${resolvedPath} */
|
|
733
|
-
${depCode}
|
|
734
|
-
/* End: ${resolvedPath} */
|
|
735
|
-
${res}
|
|
736
|
-
`;
|
|
737
|
-
lines += 3 + depLines;
|
|
738
|
-
} else {
|
|
739
|
-
res = depCode + '\n' + res;
|
|
740
|
-
lines += 1 + depLines;
|
|
741
|
-
}
|
|
723
|
+
res = depCode + '\n' + res;
|
|
724
|
+
lines += 1 + depLines;
|
|
742
725
|
map = depMap;
|
|
743
726
|
}
|
|
744
727
|
} else {
|
|
@@ -809,11 +792,6 @@ ${code}
|
|
|
809
792
|
|
|
810
793
|
lineCount += 2;
|
|
811
794
|
|
|
812
|
-
if (debugTools['asset-file-names-in-output']) {
|
|
813
|
-
code = `/* ${this.getAssetFilePath(asset)} */\n` + code;
|
|
814
|
-
lineCount += 1;
|
|
815
|
-
}
|
|
816
|
-
|
|
817
795
|
for (let [depCode, map, lines] of depContent) {
|
|
818
796
|
if (!depCode) continue;
|
|
819
797
|
code += depCode + '\n';
|