@atlaspack/optimizer-inline-requires 2.14.5-canary.138 → 2.14.5-canary.139

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -29,15 +29,17 @@ function _sourceMap() {
29
29
  return data;
30
30
  }
31
31
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
32
+ // @ts-expect-error TS7034
32
33
  let assetPublicIdsWithSideEffects = null;
33
- // $FlowFixMe not sure how to anotate the export here to make it work...
34
34
  module.exports = new (_plugin().Optimizer)({
35
35
  loadBundleConfig({
36
36
  bundle,
37
37
  bundleGraph,
38
38
  tracer
39
39
  }) {
40
+ // @ts-expect-error TS7005
40
41
  if (assetPublicIdsWithSideEffects !== null) {
42
+ // @ts-expect-error TS7005
41
43
  return {
42
44
  assetPublicIdsWithSideEffects
43
45
  };
@@ -52,6 +54,7 @@ module.exports = new (_plugin().Optimizer)({
52
54
  bundleGraph.traverse(node => {
53
55
  if (node.type === 'asset' && node.value.sideEffects) {
54
56
  const publicId = bundleGraph.getAssetPublicId(node.value);
57
+ // @ts-expect-error TS7005
55
58
  let sideEffectsMap = (0, _nullthrows().default)(assetPublicIdsWithSideEffects);
56
59
  sideEffectsMap.add(publicId);
57
60
  }
@@ -82,14 +85,18 @@ module.exports = new (_plugin().Optimizer)({
82
85
  sourceMaps: !!bundle.env.sourceMap,
83
86
  ignoreModuleIds: Array.from(bundleConfig.assetPublicIdsWithSideEffects)
84
87
  });
88
+
89
+ // @ts-expect-error TS2339
85
90
  const sourceMapResult = result.sourceMap;
86
91
  if (sourceMapResult != null) {
87
92
  sourceMap = new (_sourceMap().default)(options.projectRoot);
88
93
  sourceMap.addVLQMap(JSON.parse(sourceMapResult));
89
94
  if (originalMap) {
95
+ // @ts-expect-error TS2345
90
96
  sourceMap.extends(originalMap);
91
97
  }
92
98
  }
99
+ // @ts-expect-error TS2339
93
100
  return {
94
101
  contents: result.code,
95
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.138+eda07caaf",
3
+ "version": "2.14.5-canary.139+d2fd84977",
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.206+eda07caaf",
19
- "@atlaspack/plugin": "2.14.5-canary.138+eda07caaf",
20
- "@atlaspack/rust": "3.2.1-canary.138+eda07caaf",
21
- "@atlaspack/types": "2.14.5-canary.138+eda07caaf",
19
+ "@atlaspack/feature-flags": "2.14.1-canary.207+d2fd84977",
20
+ "@atlaspack/plugin": "2.14.5-canary.139+d2fd84977",
21
+ "@atlaspack/rust": "3.2.1-canary.139+d2fd84977",
22
+ "@atlaspack/types": "2.14.5-canary.139+d2fd84977",
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": "eda07caafd2ebb814bbdbfd0ec12fa63124e213f"
28
- }
28
+ "scripts": {
29
+ "check-ts": "tsc --emitDeclarationOnly --rootDir src"
30
+ },
31
+ "gitHead": "d2fd849770fe6305e9c694bd97b1bd905abd9d94"
32
+ }
@@ -1,19 +1,20 @@
1
- // @flow strict-local
2
1
  import {Optimizer} from '@atlaspack/plugin';
3
2
  import {runInlineRequiresOptimizerAsync} from '@atlaspack/rust';
4
3
  import nullthrows from 'nullthrows';
5
4
  import SourceMap from '@parcel/source-map';
6
5
 
6
+ // @ts-expect-error TS7034
7
7
  let assetPublicIdsWithSideEffects = null;
8
8
 
9
- type BundleConfig = {|
10
- assetPublicIdsWithSideEffects: Set<string>,
11
- |};
9
+ type BundleConfig = {
10
+ assetPublicIdsWithSideEffects: Set<string>;
11
+ };
12
12
 
13
- // $FlowFixMe not sure how to anotate the export here to make it work...
14
- module.exports = new Optimizer<empty, BundleConfig>({
13
+ module.exports = new Optimizer<never, BundleConfig>({
15
14
  loadBundleConfig({bundle, bundleGraph, tracer}): BundleConfig {
15
+ // @ts-expect-error TS7005
16
16
  if (assetPublicIdsWithSideEffects !== null) {
17
+ // @ts-expect-error TS7005
17
18
  return {assetPublicIdsWithSideEffects};
18
19
  }
19
20
 
@@ -32,6 +33,7 @@ module.exports = new Optimizer<empty, BundleConfig>({
32
33
  bundleGraph.traverse((node) => {
33
34
  if (node.type === 'asset' && node.value.sideEffects) {
34
35
  const publicId = bundleGraph.getAssetPublicId(node.value);
36
+ // @ts-expect-error TS7005
35
37
  let sideEffectsMap = nullthrows(assetPublicIdsWithSideEffects);
36
38
  sideEffectsMap.add(publicId);
37
39
  }
@@ -62,16 +64,19 @@ module.exports = new Optimizer<empty, BundleConfig>({
62
64
  ignoreModuleIds: Array.from(bundleConfig.assetPublicIdsWithSideEffects),
63
65
  });
64
66
 
67
+ // @ts-expect-error TS2339
65
68
  const sourceMapResult = result.sourceMap;
66
69
  if (sourceMapResult != null) {
67
70
  sourceMap = new SourceMap(options.projectRoot);
68
71
  sourceMap.addVLQMap(JSON.parse(sourceMapResult));
69
72
  if (originalMap) {
73
+ // @ts-expect-error TS2345
70
74
  sourceMap.extends(originalMap);
71
75
  }
72
76
  }
77
+ // @ts-expect-error TS2339
73
78
  return {contents: result.code, map: sourceMap};
74
- } catch (err) {
79
+ } catch (err: any) {
75
80
  logger.warn({
76
81
  origin: 'atlaspack-optimizer-experimental-inline-requires',
77
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
+ }