@atlaspack/core 2.16.2-canary.414 → 2.16.2-canary.415

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.
@@ -376,7 +376,8 @@ function reconcileNewRuntimes(api, connections, optionsRef) {
376
376
  name: 'Runtimes',
377
377
  assetGroups,
378
378
  optionsRef,
379
- skipSymbolProp: (0, feature_flags_1.getFeatureFlag)('skipRuntimeSymbolProp'),
379
+ skipSymbolProp: (0, feature_flags_1.getFeatureFlag)('skipRuntimeSymbolProp') ||
380
+ (0, feature_flags_1.getFeatureFlag)('rustSymbolTracker'),
380
381
  });
381
382
  // rebuild the graph
382
383
  return api.runRequest(request, { force: true });
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
@@ -7,7 +40,7 @@ exports.createAssetGraphRequestRust = createAssetGraphRequestRust;
7
40
  exports.getAssetGraph = getAssetGraph;
8
41
  const assert_1 = __importDefault(require("assert"));
9
42
  const diagnostic_1 = __importDefault(require("@atlaspack/diagnostic"));
10
- const logger_1 = require("@atlaspack/logger");
43
+ const logger_1 = __importStar(require("@atlaspack/logger"));
11
44
  const feature_flags_1 = require("@atlaspack/feature-flags");
12
45
  const AssetGraph_1 = __importDefault(require("../AssetGraph"));
13
46
  const RequestTracker_1 = require("../RequestTracker");
@@ -20,8 +53,8 @@ function createAssetGraphRequestRust(rustAtlaspack) {
20
53
  return (input) => ({
21
54
  type: RequestTracker_1.requestTypes.asset_graph_request,
22
55
  id: input.name,
23
- run: async (input) => {
24
- let options = input.options;
56
+ run: async (runInput) => {
57
+ let options = runInput.options;
25
58
  let { assetGraphPromise, commitPromise } = await rustAtlaspack.buildAssetGraph();
26
59
  let [serializedAssetGraph, assetGraphError] = (await assetGraphPromise);
27
60
  if (assetGraphError) {
@@ -33,24 +66,33 @@ function createAssetGraphRequestRust(rustAtlaspack) {
33
66
  let prevResult = null;
34
67
  if (serializedAssetGraph.hadPreviousGraph) {
35
68
  prevResult =
36
- await input.api.getPreviousResult();
69
+ await runInput.api.getPreviousResult();
37
70
  }
38
71
  let { assetGraph, changedAssets } = (0, logger_1.instrument)('atlaspack_v3_getAssetGraph', () => getAssetGraph(serializedAssetGraph, prevResult?.assetGraph));
39
72
  let changedAssetsPropagation = new Set(changedAssets.keys());
40
- let errors = (0, SymbolPropagation_1.propagateSymbols)({
41
- options,
42
- assetGraph,
43
- changedAssetsPropagation,
44
- assetGroupsWithRemovedParents: new Set(),
45
- previousErrors: new Map(), //this.previousSymbolPropagationErrors,
46
- });
47
- if (errors.size > 0) {
48
- // Just throw the first error. Since errors can bubble (e.g. reexporting a reexported symbol also fails),
49
- // determining which failing export is the root cause is nontrivial (because of circular dependencies).
50
- throw new diagnostic_1.default({
51
- diagnostic: [...errors.values()][0],
73
+ // Skip symbol propagation for runtime assets - they have pre-computed symbol data
74
+ if (input.skipSymbolProp) {
75
+ logger_1.default.verbose({
76
+ origin: '@atlaspack/core',
77
+ message: 'Skipping symbol propagation for runtime asset graph',
52
78
  });
53
79
  }
80
+ else {
81
+ let errors = (0, SymbolPropagation_1.propagateSymbols)({
82
+ options,
83
+ assetGraph,
84
+ changedAssetsPropagation,
85
+ assetGroupsWithRemovedParents: new Set(),
86
+ previousErrors: new Map(), //this.previousSymbolPropagationErrors,
87
+ });
88
+ if (errors.size > 0) {
89
+ // Just throw the first error. Since errors can bubble (e.g. reexporting a reexported symbol also fails),
90
+ // determining which failing export is the root cause is nontrivial (because of circular dependencies).
91
+ throw new diagnostic_1.default({
92
+ diagnostic: [...errors.values()][0],
93
+ });
94
+ }
95
+ }
54
96
  await (0, dumpGraphToGraphViz_1.default)(assetGraph, 'AssetGraphV3');
55
97
  let result = {
56
98
  assetGraph,
@@ -68,8 +110,8 @@ function createAssetGraphRequestRust(rustAtlaspack) {
68
110
  },
69
111
  });
70
112
  }
71
- await input.api.storeResult(result);
72
- input.api.invalidateOnBuild();
113
+ await runInput.api.storeResult(result);
114
+ runInput.api.invalidateOnBuild();
73
115
  return result;
74
116
  },
75
117
  input,
@@ -230,6 +272,17 @@ function getAssetGraph(serializedGraph, prevAssetGraph) {
230
272
  }
231
273
  let usedSymbolsDown = new Set();
232
274
  let usedSymbolsUp = new Map();
275
+ if (node.used_symbols_up) {
276
+ for (let usedSymbol of node.used_symbols_up) {
277
+ // Transform Rust UsedSymbol { symbol: Symbol, asset: string }
278
+ // to JS format { symbol: string, asset: string } where symbol is the exported name
279
+ const exportedName = usedSymbol.symbol.exported;
280
+ usedSymbolsUp.set(exportedName, {
281
+ asset: usedSymbol.asset,
282
+ symbol: exportedName,
283
+ });
284
+ }
285
+ }
233
286
  if (dependency.isEntry && dependency.isLibrary) {
234
287
  usedSymbolsDown.add('*');
235
288
  usedSymbolsUp.set('*', undefined);
@@ -110,6 +110,7 @@ function createBundleGraphRequest(input) {
110
110
  lazyIncludes: options.lazyIncludes,
111
111
  lazyExcludes: options.lazyExcludes,
112
112
  requestedAssetIds,
113
+ skipSymbolProp: (0, feature_flags_1.getFeatureFlag)('rustSymbolTracker'),
113
114
  });
114
115
  let { assetGraph, changedAssets, assetRequests } = await (0, logger_1.instrumentAsync)('asset-graph-request', () => {
115
116
  return api.runRequest(request, {
@@ -437,7 +437,7 @@ function reconcileNewRuntimes(api, connections, optionsRef) {
437
437
  name: 'Runtimes',
438
438
  assetGroups,
439
439
  optionsRef,
440
- skipSymbolProp: (0, _featureFlags().getFeatureFlag)('skipRuntimeSymbolProp')
440
+ skipSymbolProp: (0, _featureFlags().getFeatureFlag)('skipRuntimeSymbolProp') || (0, _featureFlags().getFeatureFlag)('rustSymbolTracker')
441
441
  });
442
442
 
443
443
  // rebuild the graph
@@ -20,7 +20,7 @@ function _diagnostic() {
20
20
  return data;
21
21
  }
22
22
  function _logger() {
23
- const data = require("@atlaspack/logger");
23
+ const data = _interopRequireWildcard(require("@atlaspack/logger"));
24
24
  _logger = function () {
25
25
  return data;
26
26
  };
@@ -39,13 +39,15 @@ var _SymbolPropagation = require("../SymbolPropagation");
39
39
  var _EnvironmentManager = require("../EnvironmentManager");
40
40
  var _Environment = require("../Environment");
41
41
  var _dumpGraphToGraphViz = _interopRequireDefault(require("../dumpGraphToGraphViz"));
42
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
43
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
42
44
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43
45
  function createAssetGraphRequestRust(rustAtlaspack) {
44
46
  return input => ({
45
47
  type: _RequestTracker.requestTypes.asset_graph_request,
46
48
  id: input.name,
47
- run: async input => {
48
- let options = input.options;
49
+ run: async runInput => {
50
+ let options = runInput.options;
49
51
  let {
50
52
  assetGraphPromise,
51
53
  commitPromise
@@ -60,7 +62,7 @@ function createAssetGraphRequestRust(rustAtlaspack) {
60
62
  // Don't reuse a previous asset graph result if Rust didn't have one too
61
63
  let prevResult = null;
62
64
  if (serializedAssetGraph.hadPreviousGraph) {
63
- prevResult = await input.api.getPreviousResult();
65
+ prevResult = await runInput.api.getPreviousResult();
64
66
  }
65
67
  let {
66
68
  assetGraph,
@@ -70,20 +72,28 @@ function createAssetGraphRequestRust(rustAtlaspack) {
70
72
  return getAssetGraph(serializedAssetGraph, (_prevResult = prevResult) === null || _prevResult === void 0 ? void 0 : _prevResult.assetGraph);
71
73
  });
72
74
  let changedAssetsPropagation = new Set(changedAssets.keys());
73
- let errors = (0, _SymbolPropagation.propagateSymbols)({
74
- options,
75
- assetGraph,
76
- changedAssetsPropagation,
77
- assetGroupsWithRemovedParents: new Set(),
78
- previousErrors: new Map() //this.previousSymbolPropagationErrors,
79
- });
80
-
81
- if (errors.size > 0) {
82
- // Just throw the first error. Since errors can bubble (e.g. reexporting a reexported symbol also fails),
83
- // determining which failing export is the root cause is nontrivial (because of circular dependencies).
84
- throw new (_diagnostic().default)({
85
- diagnostic: [...errors.values()][0]
75
+ // Skip symbol propagation for runtime assets - they have pre-computed symbol data
76
+ if (input.skipSymbolProp) {
77
+ _logger().default.verbose({
78
+ origin: '@atlaspack/core',
79
+ message: 'Skipping symbol propagation for runtime asset graph'
80
+ });
81
+ } else {
82
+ let errors = (0, _SymbolPropagation.propagateSymbols)({
83
+ options,
84
+ assetGraph,
85
+ changedAssetsPropagation,
86
+ assetGroupsWithRemovedParents: new Set(),
87
+ previousErrors: new Map() //this.previousSymbolPropagationErrors,
86
88
  });
89
+
90
+ if (errors.size > 0) {
91
+ // Just throw the first error. Since errors can bubble (e.g. reexporting a reexported symbol also fails),
92
+ // determining which failing export is the root cause is nontrivial (because of circular dependencies).
93
+ throw new (_diagnostic().default)({
94
+ diagnostic: [...errors.values()][0]
95
+ });
96
+ }
87
97
  }
88
98
  await (0, _dumpGraphToGraphViz.default)(assetGraph, 'AssetGraphV3');
89
99
  let result = {
@@ -102,8 +112,8 @@ function createAssetGraphRequestRust(rustAtlaspack) {
102
112
  }
103
113
  });
104
114
  }
105
- await input.api.storeResult(result);
106
- input.api.invalidateOnBuild();
115
+ await runInput.api.storeResult(result);
116
+ runInput.api.invalidateOnBuild();
107
117
  return result;
108
118
  },
109
119
  input
@@ -253,6 +263,17 @@ function getAssetGraph(serializedGraph, prevAssetGraph) {
253
263
  }
254
264
  let usedSymbolsDown = new Set();
255
265
  let usedSymbolsUp = new Map();
266
+ if (node.used_symbols_up) {
267
+ for (let usedSymbol of node.used_symbols_up) {
268
+ // Transform Rust UsedSymbol { symbol: Symbol, asset: string }
269
+ // to JS format { symbol: string, asset: string } where symbol is the exported name
270
+ const exportedName = usedSymbol.symbol.exported;
271
+ usedSymbolsUp.set(exportedName, {
272
+ asset: usedSymbol.asset,
273
+ symbol: exportedName
274
+ });
275
+ }
276
+ }
256
277
  if (dependency.isEntry && dependency.isLibrary) {
257
278
  usedSymbolsDown.add('*');
258
279
  usedSymbolsUp.set('*', undefined);
@@ -136,7 +136,8 @@ function createBundleGraphRequest(input) {
136
136
  shouldBuildLazily: options.shouldBuildLazily,
137
137
  lazyIncludes: options.lazyIncludes,
138
138
  lazyExcludes: options.lazyExcludes,
139
- requestedAssetIds
139
+ requestedAssetIds,
140
+ skipSymbolProp: (0, _featureFlags().getFeatureFlag)('rustSymbolTracker')
140
141
  });
141
142
  let {
142
143
  assetGraph,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.16.2-canary.414+c4082ba3f",
3
+ "version": "2.16.2-canary.415+45a0dc530",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -22,22 +22,22 @@
22
22
  "build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
23
23
  },
24
24
  "dependencies": {
25
- "@atlaspack/build-cache": "2.13.3-canary.482+c4082ba3f",
26
- "@atlaspack/cache": "3.1.1-canary.414+c4082ba3f",
27
- "@atlaspack/diagnostic": "2.14.1-canary.482+c4082ba3f",
28
- "@atlaspack/events": "2.14.1-canary.482+c4082ba3f",
29
- "@atlaspack/feature-flags": "2.14.1-canary.482+c4082ba3f",
30
- "@atlaspack/fs": "2.14.5-canary.414+c4082ba3f",
31
- "@atlaspack/graph": "3.4.1-canary.482+c4082ba3f",
32
- "@atlaspack/logger": "2.14.5-canary.414+c4082ba3f",
33
- "@atlaspack/package-manager": "2.14.5-canary.414+c4082ba3f",
34
- "@atlaspack/plugin": "2.14.5-canary.414+c4082ba3f",
35
- "@atlaspack/profiler": "2.14.1-canary.482+c4082ba3f",
36
- "@atlaspack/rust": "3.2.1-canary.414+c4082ba3f",
37
- "@atlaspack/source-map": "3.2.9-canary.4193+c4082ba3f",
38
- "@atlaspack/types": "2.14.5-canary.414+c4082ba3f",
39
- "@atlaspack/utils": "2.14.5-canary.414+c4082ba3f",
40
- "@atlaspack/workers": "2.14.5-canary.414+c4082ba3f",
25
+ "@atlaspack/build-cache": "2.13.3-canary.483+45a0dc530",
26
+ "@atlaspack/cache": "3.1.1-canary.415+45a0dc530",
27
+ "@atlaspack/diagnostic": "2.14.1-canary.483+45a0dc530",
28
+ "@atlaspack/events": "2.14.1-canary.483+45a0dc530",
29
+ "@atlaspack/feature-flags": "2.14.1-canary.483+45a0dc530",
30
+ "@atlaspack/fs": "2.14.5-canary.415+45a0dc530",
31
+ "@atlaspack/graph": "3.4.1-canary.483+45a0dc530",
32
+ "@atlaspack/logger": "2.14.5-canary.415+45a0dc530",
33
+ "@atlaspack/package-manager": "2.14.5-canary.415+45a0dc530",
34
+ "@atlaspack/plugin": "2.14.5-canary.415+45a0dc530",
35
+ "@atlaspack/profiler": "2.14.1-canary.483+45a0dc530",
36
+ "@atlaspack/rust": "3.2.1-canary.415+45a0dc530",
37
+ "@atlaspack/source-map": "3.2.9-canary.4194+45a0dc530",
38
+ "@atlaspack/types": "2.14.5-canary.415+45a0dc530",
39
+ "@atlaspack/utils": "2.14.5-canary.415+45a0dc530",
40
+ "@atlaspack/workers": "2.14.5-canary.415+45a0dc530",
41
41
  "@mischnic/json-sourcemap": "^0.1.0",
42
42
  "base-x": "^3.0.8",
43
43
  "browserslist": "^4.6.6",
@@ -61,5 +61,5 @@
61
61
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
62
62
  },
63
63
  "type": "commonjs",
64
- "gitHead": "c4082ba3fc1a9328a2e5f23195d5972fbc5d10c8"
64
+ "gitHead": "45a0dc530fd9472dbfdebcbb05f1aad812ab3b23"
65
65
  }
@@ -505,7 +505,9 @@ function reconcileNewRuntimes<TResult extends RequestResult>(
505
505
  name: 'Runtimes',
506
506
  assetGroups,
507
507
  optionsRef,
508
- skipSymbolProp: getFeatureFlag('skipRuntimeSymbolProp'),
508
+ skipSymbolProp:
509
+ getFeatureFlag('skipRuntimeSymbolProp') ||
510
+ getFeatureFlag('rustSymbolTracker'),
509
511
  });
510
512
 
511
513
  // rebuild the graph
@@ -2,7 +2,7 @@ import invariant from 'assert';
2
2
 
3
3
  import ThrowableDiagnostic from '@atlaspack/diagnostic';
4
4
  import type {Async} from '@atlaspack/types';
5
- import {instrument} from '@atlaspack/logger';
5
+ import logger, {instrument} from '@atlaspack/logger';
6
6
  import {getFeatureFlag} from '@atlaspack/feature-flags';
7
7
 
8
8
  import AssetGraph from '../AssetGraph';
@@ -51,8 +51,8 @@ export function createAssetGraphRequestRust(
51
51
  return (input: AssetGraphRequestInput) => ({
52
52
  type: requestTypes.asset_graph_request,
53
53
  id: input.name,
54
- run: async (input) => {
55
- let options = input.options;
54
+ run: async (runInput) => {
55
+ let options = runInput.options;
56
56
  let {assetGraphPromise, commitPromise} =
57
57
  await rustAtlaspack.buildAssetGraph();
58
58
 
@@ -69,7 +69,7 @@ export function createAssetGraphRequestRust(
69
69
  let prevResult = null;
70
70
  if (serializedAssetGraph.hadPreviousGraph) {
71
71
  prevResult =
72
- await input.api.getPreviousResult<AssetGraphRequestResult>();
72
+ await runInput.api.getPreviousResult<AssetGraphRequestResult>();
73
73
  }
74
74
 
75
75
  let {assetGraph, changedAssets} = instrument(
@@ -78,20 +78,28 @@ export function createAssetGraphRequestRust(
78
78
  );
79
79
 
80
80
  let changedAssetsPropagation = new Set(changedAssets.keys());
81
- let errors = propagateSymbols({
82
- options,
83
- assetGraph,
84
- changedAssetsPropagation,
85
- assetGroupsWithRemovedParents: new Set(),
86
- previousErrors: new Map(), //this.previousSymbolPropagationErrors,
87
- });
88
-
89
- if (errors.size > 0) {
90
- // Just throw the first error. Since errors can bubble (e.g. reexporting a reexported symbol also fails),
91
- // determining which failing export is the root cause is nontrivial (because of circular dependencies).
92
- throw new ThrowableDiagnostic({
93
- diagnostic: [...errors.values()][0],
81
+ // Skip symbol propagation for runtime assets - they have pre-computed symbol data
82
+ if (input.skipSymbolProp) {
83
+ logger.verbose({
84
+ origin: '@atlaspack/core',
85
+ message: 'Skipping symbol propagation for runtime asset graph',
94
86
  });
87
+ } else {
88
+ let errors = propagateSymbols({
89
+ options,
90
+ assetGraph,
91
+ changedAssetsPropagation,
92
+ assetGroupsWithRemovedParents: new Set(),
93
+ previousErrors: new Map(), //this.previousSymbolPropagationErrors,
94
+ });
95
+
96
+ if (errors.size > 0) {
97
+ // Just throw the first error. Since errors can bubble (e.g. reexporting a reexported symbol also fails),
98
+ // determining which failing export is the root cause is nontrivial (because of circular dependencies).
99
+ throw new ThrowableDiagnostic({
100
+ diagnostic: [...errors.values()][0],
101
+ });
102
+ }
95
103
  }
96
104
 
97
105
  await dumpGraphToGraphViz(assetGraph, 'AssetGraphV3');
@@ -116,8 +124,8 @@ export function createAssetGraphRequestRust(
116
124
  });
117
125
  }
118
126
 
119
- await input.api.storeResult(result);
120
- input.api.invalidateOnBuild();
127
+ await runInput.api.storeResult(result);
128
+ runInput.api.invalidateOnBuild();
121
129
 
122
130
  return result;
123
131
  },
@@ -314,6 +322,19 @@ export function getAssetGraph(
314
322
 
315
323
  let usedSymbolsDown = new Set();
316
324
  let usedSymbolsUp = new Map();
325
+
326
+ if (node.used_symbols_up) {
327
+ for (let usedSymbol of node.used_symbols_up) {
328
+ // Transform Rust UsedSymbol { symbol: Symbol, asset: string }
329
+ // to JS format { symbol: string, asset: string } where symbol is the exported name
330
+ const exportedName = usedSymbol.symbol.exported;
331
+ usedSymbolsUp.set(exportedName, {
332
+ asset: usedSymbol.asset,
333
+ symbol: exportedName,
334
+ });
335
+ }
336
+ }
337
+
317
338
  if (dependency.isEntry && dependency.isLibrary) {
318
339
  usedSymbolsDown.add('*');
319
340
  usedSymbolsUp.set('*', undefined);
@@ -151,6 +151,7 @@ export default function createBundleGraphRequest(
151
151
  lazyIncludes: options.lazyIncludes,
152
152
  lazyExcludes: options.lazyExcludes,
153
153
  requestedAssetIds,
154
+ skipSymbolProp: getFeatureFlag('rustSymbolTracker'),
154
155
  });
155
156
 
156
157
  let {assetGraph, changedAssets, assetRequests} = await instrumentAsync(