@atlaspack/optimizer-inline-requires 2.14.5-canary.14 → 2.14.5-canary.141

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 CHANGED
@@ -1,5 +1,158 @@
1
1
  # @atlaspack/optimizer-inline-requires
2
2
 
3
+ ## 2.14.21
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`069de47`](https://github.com/atlassian-labs/atlaspack/commit/069de478e64fb5889f6f2ce023eb510782767fbd)]:
8
+ - @atlaspack/feature-flags@2.20.0
9
+ - @atlaspack/types@2.15.11
10
+ - @atlaspack/plugin@2.14.21
11
+
12
+ ## 2.14.20
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [[`daaa768`](https://github.com/atlassian-labs/atlaspack/commit/daaa7688786772d7e3713b71c5bba6b89ec704aa), [`1c7865a`](https://github.com/atlassian-labs/atlaspack/commit/1c7865a64451116d94015e248302435839d347c0), [`a0b959f`](https://github.com/atlassian-labs/atlaspack/commit/a0b959fbf61fc3f820ff03c7e8988945fe40a91a)]:
17
+ - @atlaspack/plugin@2.14.20
18
+ - @atlaspack/feature-flags@2.19.2
19
+ - @atlaspack/types@2.15.10
20
+
21
+ ## 2.14.19
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [[`13aef17`](https://github.com/atlassian-labs/atlaspack/commit/13aef177eea289a6e40d2113b5ec1ac9be18a33d)]:
26
+ - @atlaspack/feature-flags@2.19.1
27
+ - @atlaspack/types@2.15.9
28
+ - @atlaspack/plugin@2.14.19
29
+
30
+ ## 2.14.18
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [[`dbb4072`](https://github.com/atlassian-labs/atlaspack/commit/dbb40721ebeb45990a14ba04e6b44e7f836fb32d), [`becf977`](https://github.com/atlassian-labs/atlaspack/commit/becf977f625d5ee46dae3d4c679f173bf5f40cc0), [`becf977`](https://github.com/atlassian-labs/atlaspack/commit/becf977f625d5ee46dae3d4c679f173bf5f40cc0), [`c4415a4`](https://github.com/atlassian-labs/atlaspack/commit/c4415a455543d984ca28452c2cb87a794d22497c), [`f0f7c71`](https://github.com/atlassian-labs/atlaspack/commit/f0f7c7168a1d3d18c6f30d2daed611275692b7c5), [`18a57cf`](https://github.com/atlassian-labs/atlaspack/commit/18a57cf8a4789b2de5ad8e2676f317a26cc91417)]:
35
+ - @atlaspack/feature-flags@2.19.0
36
+ - @atlaspack/rust@3.4.1
37
+ - @atlaspack/types@2.15.8
38
+ - @atlaspack/plugin@2.14.18
39
+
40
+ ## 2.14.17
41
+
42
+ ### Patch Changes
43
+
44
+ - Updated dependencies [[`c75bf55`](https://github.com/atlassian-labs/atlaspack/commit/c75bf553fff4decc285b5fd499a275853b18f8f2)]:
45
+ - @atlaspack/rust@3.4.0
46
+ - @atlaspack/types@2.15.7
47
+ - @atlaspack/plugin@2.14.17
48
+
49
+ ## 2.14.16
50
+
51
+ ### Patch Changes
52
+
53
+ - Updated dependencies [[`e8a60ff`](https://github.com/atlassian-labs/atlaspack/commit/e8a60ffbea41caef265786bbf73349771760081c)]:
54
+ - @atlaspack/feature-flags@2.18.4
55
+ - @atlaspack/types@2.15.6
56
+ - @atlaspack/plugin@2.14.16
57
+
58
+ ## 2.14.15
59
+
60
+ ### Patch Changes
61
+
62
+ - [#655](https://github.com/atlassian-labs/atlaspack/pull/655) [`5ded263`](https://github.com/atlassian-labs/atlaspack/commit/5ded263c7f11b866e8885b81c73e20dd060b25be) Thanks [@yamadapc](https://github.com/yamadapc)! - Clean-up inline requires multi-threading feature-flag
63
+
64
+ - Updated dependencies [[`5ded263`](https://github.com/atlassian-labs/atlaspack/commit/5ded263c7f11b866e8885b81c73e20dd060b25be)]:
65
+ - @atlaspack/feature-flags@2.18.3
66
+ - @atlaspack/types@2.15.5
67
+ - @atlaspack/plugin@2.14.15
68
+
69
+ ## 2.14.14
70
+
71
+ ### Patch Changes
72
+
73
+ - Updated dependencies [[`644b157`](https://github.com/atlassian-labs/atlaspack/commit/644b157dee72a871acc2d0facf0b87b8eea51956)]:
74
+ - @atlaspack/feature-flags@2.18.2
75
+ - @atlaspack/types@2.15.4
76
+ - @atlaspack/plugin@2.14.14
77
+
78
+ ## 2.14.13
79
+
80
+ ### Patch Changes
81
+
82
+ - Updated dependencies [[`26aa9c5`](https://github.com/atlassian-labs/atlaspack/commit/26aa9c599d2be45ce1438a74c5fa22f39b9b554b), [`0501255`](https://github.com/atlassian-labs/atlaspack/commit/05012550da35b05ce7d356a8cc29311e7f9afdca)]:
83
+ - @atlaspack/feature-flags@2.18.1
84
+ - @atlaspack/types@2.15.3
85
+ - @atlaspack/plugin@2.14.13
86
+
87
+ ## 2.14.12
88
+
89
+ ### Patch Changes
90
+
91
+ - Updated dependencies [[`10fbcfb`](https://github.com/atlassian-labs/atlaspack/commit/10fbcfbfa49c7a83da5d7c40983e36e87f524a75), [`85c52d3`](https://github.com/atlassian-labs/atlaspack/commit/85c52d3f7717b3c84a118d18ab98cfbfd71dcbd2)]:
92
+ - @atlaspack/feature-flags@2.18.0
93
+ - @atlaspack/types@2.15.2
94
+ - @atlaspack/plugin@2.14.12
95
+
96
+ ## 2.14.11
97
+
98
+ ### Patch Changes
99
+
100
+ - Updated dependencies [[`73ea3c4`](https://github.com/atlassian-labs/atlaspack/commit/73ea3c4d85d4401fdd15abcbf988237e890e7ad3), [`b1b3693`](https://github.com/atlassian-labs/atlaspack/commit/b1b369317c66f8a431c170df2ebba4fa5b2e38ef)]:
101
+ - @atlaspack/feature-flags@2.17.0
102
+ - @atlaspack/types@2.15.1
103
+ - @atlaspack/plugin@2.14.11
104
+
105
+ ## 2.14.10
106
+
107
+ ### Patch Changes
108
+
109
+ - Updated dependencies [[`51aba5f`](https://github.com/atlassian-labs/atlaspack/commit/51aba5fc0e49235ee06bbc3c376f48c3e7da5c4b), [`1e32d4e`](https://github.com/atlassian-labs/atlaspack/commit/1e32d4eae6b3af3968e8a0ef97d35b4347fd4196), [`35fdd4b`](https://github.com/atlassian-labs/atlaspack/commit/35fdd4b52da0af20f74667f7b8adfb2f90279b7c), [`6dd4ccb`](https://github.com/atlassian-labs/atlaspack/commit/6dd4ccb753541de32322d881f973d571dd57e4ca)]:
110
+ - @atlaspack/types@2.15.0
111
+ - @atlaspack/rust@3.3.5
112
+ - @atlaspack/plugin@2.14.10
113
+
114
+ ## 2.14.9
115
+
116
+ ### Patch Changes
117
+
118
+ - Updated dependencies [[`124b7ff`](https://github.com/atlassian-labs/atlaspack/commit/124b7fff44f71aac9fbad289a9a9509b3dfc9aaa), [`e052521`](https://github.com/atlassian-labs/atlaspack/commit/e0525210850ed1606146eb86991049cf567c5dec), [`15c6d70`](https://github.com/atlassian-labs/atlaspack/commit/15c6d7000bd89da876bc590aa75b17a619a41896), [`e4d966c`](https://github.com/atlassian-labs/atlaspack/commit/e4d966c3c9c4292c5013372ae65b10d19d4bacc6), [`209692f`](https://github.com/atlassian-labs/atlaspack/commit/209692ffb11eae103a0d65c5e1118a5aa1625818), [`42a775d`](https://github.com/atlassian-labs/atlaspack/commit/42a775de8eec638ad188f3271964170d8c04d84b), [`29c2f10`](https://github.com/atlassian-labs/atlaspack/commit/29c2f106de9679adfb5afa04e1910471dc65a427), [`f4da1e1`](https://github.com/atlassian-labs/atlaspack/commit/f4da1e120e73eeb5e8b8927f05e88f04d6148c7b), [`1ef91fc`](https://github.com/atlassian-labs/atlaspack/commit/1ef91fcc863fdd2831511937083dbbc1263b3d9d)]:
119
+ - @atlaspack/rust@3.3.4
120
+ - @atlaspack/feature-flags@2.16.0
121
+ - @atlaspack/types@2.14.9
122
+ - @atlaspack/plugin@2.14.9
123
+
124
+ ## 2.14.8
125
+
126
+ ### Patch Changes
127
+
128
+ - Updated dependencies [[`30f6017`](https://github.com/atlassian-labs/atlaspack/commit/30f60175ba4d272c5fc193973c63bc298584775b), [`1ab0a27`](https://github.com/atlassian-labs/atlaspack/commit/1ab0a275aeca40350415e2b03e7440d1dddc6228), [`b8a4ae8`](https://github.com/atlassian-labs/atlaspack/commit/b8a4ae8f83dc0a83d8b145c5f729936ce52080a3)]:
129
+ - @atlaspack/feature-flags@2.15.1
130
+ - @atlaspack/rust@3.3.3
131
+ - @atlaspack/types@2.14.8
132
+ - @atlaspack/plugin@2.14.8
133
+
134
+ ## 2.14.7
135
+
136
+ ### Patch Changes
137
+
138
+ - Updated dependencies [[`a1773d2`](https://github.com/atlassian-labs/atlaspack/commit/a1773d2a62d0ef7805ac7524621dcabcc1afe929), [`556d6ab`](https://github.com/atlassian-labs/atlaspack/commit/556d6ab8ede759fa7f37fcd3f4da336ef1c55e8f)]:
139
+ - @atlaspack/feature-flags@2.15.0
140
+ - @atlaspack/rust@3.3.2
141
+ - @atlaspack/types@2.14.7
142
+ - @atlaspack/plugin@2.14.7
143
+
144
+ ## 2.14.6
145
+
146
+ ### Patch Changes
147
+
148
+ - [#542](https://github.com/atlassian-labs/atlaspack/pull/542) [`e0f5337`](https://github.com/atlassian-labs/atlaspack/commit/e0f533757bd1019dbd108a04952c87da15286e09) Thanks [@yamadapc](https://github.com/yamadapc)! - Add feature-flagged option to use rayon thread-pool to optimize inline requires
149
+
150
+ - Updated dependencies [[`e0f5337`](https://github.com/atlassian-labs/atlaspack/commit/e0f533757bd1019dbd108a04952c87da15286e09)]:
151
+ - @atlaspack/feature-flags@2.14.4
152
+ - @atlaspack/rust@3.3.1
153
+ - @atlaspack/types@2.14.6
154
+ - @atlaspack/plugin@2.14.6
155
+
3
156
  ## 2.14.5
4
157
 
5
158
  ### Patch Changes
@@ -0,0 +1 @@
1
+ export {};
@@ -14,13 +14,6 @@ function _rust() {
14
14
  };
15
15
  return data;
16
16
  }
17
- function _featureFlags() {
18
- const data = require("@atlaspack/feature-flags");
19
- _featureFlags = function () {
20
- return data;
21
- };
22
- return data;
23
- }
24
17
  function _nullthrows() {
25
18
  const data = _interopRequireDefault(require("nullthrows"));
26
19
  _nullthrows = function () {
@@ -36,15 +29,17 @@ function _sourceMap() {
36
29
  return data;
37
30
  }
38
31
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
32
+ // @ts-expect-error TS7034
39
33
  let assetPublicIdsWithSideEffects = null;
40
- // $FlowFixMe not sure how to anotate the export here to make it work...
41
34
  module.exports = new (_plugin().Optimizer)({
42
35
  loadBundleConfig({
43
36
  bundle,
44
37
  bundleGraph,
45
38
  tracer
46
39
  }) {
40
+ // @ts-expect-error TS7005
47
41
  if (assetPublicIdsWithSideEffects !== null) {
42
+ // @ts-expect-error TS7005
48
43
  return {
49
44
  assetPublicIdsWithSideEffects
50
45
  };
@@ -59,6 +54,7 @@ module.exports = new (_plugin().Optimizer)({
59
54
  bundleGraph.traverse(node => {
60
55
  if (node.type === 'asset' && node.value.sideEffects) {
61
56
  const publicId = bundleGraph.getAssetPublicId(node.value);
57
+ // @ts-expect-error TS7005
62
58
  let sideEffectsMap = (0, _nullthrows().default)(assetPublicIdsWithSideEffects);
63
59
  sideEffectsMap.add(publicId);
64
60
  }
@@ -84,23 +80,23 @@ module.exports = new (_plugin().Optimizer)({
84
80
  }
85
81
  try {
86
82
  let sourceMap = null;
87
- const result = (0, _featureFlags().getFeatureFlag)('inlineRequiresMultiThreading') ? await (0, _rust().runInlineRequiresOptimizerAsync)({
88
- code: contents.toString(),
89
- sourceMaps: !!bundle.env.sourceMap,
90
- ignoreModuleIds: Array.from(bundleConfig.assetPublicIdsWithSideEffects)
91
- }) : (0, _rust().runInlineRequiresOptimizer)({
83
+ const result = await (0, _rust().runInlineRequiresOptimizerAsync)({
92
84
  code: contents.toString(),
93
85
  sourceMaps: !!bundle.env.sourceMap,
94
86
  ignoreModuleIds: Array.from(bundleConfig.assetPublicIdsWithSideEffects)
95
87
  });
88
+
89
+ // @ts-expect-error TS2339
96
90
  const sourceMapResult = result.sourceMap;
97
91
  if (sourceMapResult != null) {
98
92
  sourceMap = new (_sourceMap().default)(options.projectRoot);
99
93
  sourceMap.addVLQMap(JSON.parse(sourceMapResult));
100
94
  if (originalMap) {
95
+ // @ts-expect-error TS2345
101
96
  sourceMap.extends(originalMap);
102
97
  }
103
98
  }
99
+ // @ts-expect-error TS2339
104
100
  return {
105
101
  contents: result.code,
106
102
  map: sourceMap
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/optimizer-inline-requires",
3
- "version": "2.14.5-canary.14+267b0d591",
3
+ "version": "2.14.5-canary.141+2f29297bd",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -9,20 +9,24 @@
9
9
  "type": "git",
10
10
  "url": "https://github.com/atlassian-labs/atlaspack.git"
11
11
  },
12
- "main": "lib/InlineRequires.js",
13
- "source": "src/InlineRequires.js",
12
+ "main": "./lib/InlineRequires.js",
13
+ "source": "./src/InlineRequires.ts",
14
+ "types": "./lib/InlineRequires.d.ts",
14
15
  "engines": {
15
16
  "node": ">= 14.0.0"
16
17
  },
17
18
  "dependencies": {
18
- "@atlaspack/feature-flags": "2.14.1-canary.82+267b0d591",
19
- "@atlaspack/plugin": "2.14.5-canary.14+267b0d591",
20
- "@atlaspack/rust": "3.2.1-canary.14+267b0d591",
21
- "@atlaspack/types": "2.14.5-canary.14+267b0d591",
19
+ "@atlaspack/feature-flags": "2.14.1-canary.209+2f29297bd",
20
+ "@atlaspack/plugin": "2.14.5-canary.141+2f29297bd",
21
+ "@atlaspack/rust": "3.2.1-canary.141+2f29297bd",
22
+ "@atlaspack/types": "2.14.5-canary.141+2f29297bd",
22
23
  "@parcel/source-map": "^2.1.1",
23
24
  "@swc/core": "^1.10.0",
24
25
  "nullthrows": "^1.1.1"
25
26
  },
26
27
  "type": "commonjs",
27
- "gitHead": "267b0d59131c00e4cd1526bbf87aa84b9c8fd411"
28
- }
28
+ "scripts": {
29
+ "check-ts": "tsc --emitDeclarationOnly --rootDir src"
30
+ },
31
+ "gitHead": "2f29297bd550840c9840871559349ef773bcbf6d"
32
+ }
@@ -1,23 +1,20 @@
1
- // @flow strict-local
2
1
  import {Optimizer} from '@atlaspack/plugin';
3
- import {
4
- runInlineRequiresOptimizer,
5
- runInlineRequiresOptimizerAsync,
6
- } from '@atlaspack/rust';
7
- import {getFeatureFlag} from '@atlaspack/feature-flags';
2
+ import {runInlineRequiresOptimizerAsync} from '@atlaspack/rust';
8
3
  import nullthrows from 'nullthrows';
9
4
  import SourceMap from '@parcel/source-map';
10
5
 
6
+ // @ts-expect-error TS7034
11
7
  let assetPublicIdsWithSideEffects = null;
12
8
 
13
- type BundleConfig = {|
14
- assetPublicIdsWithSideEffects: Set<string>,
15
- |};
9
+ type BundleConfig = {
10
+ assetPublicIdsWithSideEffects: Set<string>;
11
+ };
16
12
 
17
- // $FlowFixMe not sure how to anotate the export here to make it work...
18
- module.exports = new Optimizer<empty, BundleConfig>({
13
+ module.exports = new Optimizer<never, BundleConfig>({
19
14
  loadBundleConfig({bundle, bundleGraph, tracer}): BundleConfig {
15
+ // @ts-expect-error TS7005
20
16
  if (assetPublicIdsWithSideEffects !== null) {
17
+ // @ts-expect-error TS7005
21
18
  return {assetPublicIdsWithSideEffects};
22
19
  }
23
20
 
@@ -36,6 +33,7 @@ module.exports = new Optimizer<empty, BundleConfig>({
36
33
  bundleGraph.traverse((node) => {
37
34
  if (node.type === 'asset' && node.value.sideEffects) {
38
35
  const publicId = bundleGraph.getAssetPublicId(node.value);
36
+ // @ts-expect-error TS7005
39
37
  let sideEffectsMap = nullthrows(assetPublicIdsWithSideEffects);
40
38
  sideEffectsMap.add(publicId);
41
39
  }
@@ -60,32 +58,25 @@ module.exports = new Optimizer<empty, BundleConfig>({
60
58
 
61
59
  try {
62
60
  let sourceMap = null;
63
- const result = getFeatureFlag('inlineRequiresMultiThreading')
64
- ? await runInlineRequiresOptimizerAsync({
65
- code: contents.toString(),
66
- sourceMaps: !!bundle.env.sourceMap,
67
- ignoreModuleIds: Array.from(
68
- bundleConfig.assetPublicIdsWithSideEffects,
69
- ),
70
- })
71
- : runInlineRequiresOptimizer({
72
- code: contents.toString(),
73
- sourceMaps: !!bundle.env.sourceMap,
74
- ignoreModuleIds: Array.from(
75
- bundleConfig.assetPublicIdsWithSideEffects,
76
- ),
77
- });
61
+ const result = await runInlineRequiresOptimizerAsync({
62
+ code: contents.toString(),
63
+ sourceMaps: !!bundle.env.sourceMap,
64
+ ignoreModuleIds: Array.from(bundleConfig.assetPublicIdsWithSideEffects),
65
+ });
78
66
 
67
+ // @ts-expect-error TS2339
79
68
  const sourceMapResult = result.sourceMap;
80
69
  if (sourceMapResult != null) {
81
70
  sourceMap = new SourceMap(options.projectRoot);
82
71
  sourceMap.addVLQMap(JSON.parse(sourceMapResult));
83
72
  if (originalMap) {
73
+ // @ts-expect-error TS2345
84
74
  sourceMap.extends(originalMap);
85
75
  }
86
76
  }
77
+ // @ts-expect-error TS2339
87
78
  return {contents: result.code, map: sourceMap};
88
- } catch (err) {
79
+ } catch (err: any) {
89
80
  logger.warn({
90
81
  origin: 'atlaspack-optimizer-experimental-inline-requires',
91
82
  message: `Unable to optimise requires for ${bundle.name}: ${err.message}`,
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "include": ["src"]
4
+ }