@atlaspack/core 2.13.2-canary.3695 → 2.13.2-canary.3696

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.
@@ -4,6 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = createWriteBundlesRequest;
7
+ function _featureFlags() {
8
+ const data = require("@atlaspack/feature-flags");
9
+ _featureFlags = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
7
14
  var _RequestTracker = require("../RequestTracker");
8
15
  var _constants = require("../constants");
9
16
  var _projectPath = require("../projectPath");
@@ -54,7 +61,13 @@ async function run({
54
61
  let bundleInfoMap = {};
55
62
  let writeEarlyPromises = {};
56
63
  let hashRefToNameHash = new Map();
57
- let bundles = bundleGraph.getBundles().filter(bundle => {
64
+
65
+ // Include inline bundles so that non-inline bundles referenced from inline bundles are written to
66
+ // separate files. This ensures that source maps are written and work.
67
+ const allBundles = bundleGraph.getBundles({
68
+ includeInline: (0, _featureFlags().getFeatureFlag)('inlineBundlesSourceMapFixes')
69
+ });
70
+ const bundles = allBundles.filter(bundle => bundle.bundleBehavior !== 'inline').filter(bundle => {
58
71
  // Do not package and write placeholder bundles to disk. We just
59
72
  // need to update the name so other bundles can reference it.
60
73
  if (bundle.isPlaceholder) {
@@ -140,7 +153,8 @@ function assignComplexNameHashes(hashRefToNameHash, bundles, bundleInfoMap, opti
140
153
  }
141
154
  function getBundlesIncludedInHash(bundleId, bundleInfoMap, included = new Set()) {
142
155
  included.add(bundleId);
143
- for (let hashRef of bundleInfoMap[bundleId].hashReferences) {
156
+ for (let hashRef of ((_bundleInfoMap$bundle = bundleInfoMap[bundleId]) === null || _bundleInfoMap$bundle === void 0 ? void 0 : _bundleInfoMap$bundle.hashReferences) ?? []) {
157
+ var _bundleInfoMap$bundle;
144
158
  let referencedId = getIdFromHashRef(hashRef);
145
159
  if (!included.has(referencedId)) {
146
160
  getBundlesIncludedInHash(referencedId, bundleInfoMap, included);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.13.2-canary.3695+eff980937",
3
+ "version": "2.13.2-canary.3696+43113f8f0",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -20,21 +20,21 @@
20
20
  "check-ts": "tsc --noEmit index.d.ts"
21
21
  },
22
22
  "dependencies": {
23
- "@atlaspack/build-cache": "2.13.2-canary.3695+eff980937",
24
- "@atlaspack/cache": "2.13.2-canary.3695+eff980937",
25
- "@atlaspack/diagnostic": "2.13.2-canary.3695+eff980937",
26
- "@atlaspack/events": "2.13.2-canary.3695+eff980937",
27
- "@atlaspack/feature-flags": "2.13.2-canary.3695+eff980937",
28
- "@atlaspack/fs": "2.13.2-canary.3695+eff980937",
29
- "@atlaspack/graph": "3.3.2-canary.3695+eff980937",
30
- "@atlaspack/logger": "2.13.2-canary.3695+eff980937",
31
- "@atlaspack/package-manager": "2.13.2-canary.3695+eff980937",
32
- "@atlaspack/plugin": "2.13.2-canary.3695+eff980937",
33
- "@atlaspack/profiler": "2.13.2-canary.3695+eff980937",
34
- "@atlaspack/rust": "2.13.2-canary.3695+eff980937",
35
- "@atlaspack/types": "2.13.2-canary.3695+eff980937",
36
- "@atlaspack/utils": "2.13.2-canary.3695+eff980937",
37
- "@atlaspack/workers": "2.13.2-canary.3695+eff980937",
23
+ "@atlaspack/build-cache": "2.13.2-canary.3696+43113f8f0",
24
+ "@atlaspack/cache": "2.13.2-canary.3696+43113f8f0",
25
+ "@atlaspack/diagnostic": "2.13.2-canary.3696+43113f8f0",
26
+ "@atlaspack/events": "2.13.2-canary.3696+43113f8f0",
27
+ "@atlaspack/feature-flags": "2.13.2-canary.3696+43113f8f0",
28
+ "@atlaspack/fs": "2.13.2-canary.3696+43113f8f0",
29
+ "@atlaspack/graph": "3.3.2-canary.3696+43113f8f0",
30
+ "@atlaspack/logger": "2.13.2-canary.3696+43113f8f0",
31
+ "@atlaspack/package-manager": "2.13.2-canary.3696+43113f8f0",
32
+ "@atlaspack/plugin": "2.13.2-canary.3696+43113f8f0",
33
+ "@atlaspack/profiler": "2.13.2-canary.3696+43113f8f0",
34
+ "@atlaspack/rust": "2.13.2-canary.3696+43113f8f0",
35
+ "@atlaspack/types": "2.13.2-canary.3696+43113f8f0",
36
+ "@atlaspack/utils": "2.13.2-canary.3696+43113f8f0",
37
+ "@atlaspack/workers": "2.13.2-canary.3696+43113f8f0",
38
38
  "@mischnic/json-sourcemap": "^0.1.0",
39
39
  "@parcel/source-map": "^2.1.1",
40
40
  "base-x": "^3.0.8",
@@ -67,5 +67,5 @@
67
67
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
68
68
  },
69
69
  "type": "commonjs",
70
- "gitHead": "eff98093703b9999a511b87a19562f5aaccfcb53"
70
+ "gitHead": "43113f8f00232c5a52169a3f11f846d6e4d94b0a"
71
71
  }
@@ -2,6 +2,7 @@
2
2
 
3
3
  import type {ContentKey} from '@atlaspack/graph';
4
4
  import type {Async} from '@atlaspack/types';
5
+ import {getFeatureFlag} from '@atlaspack/feature-flags';
5
6
  import type {SharedReference} from '@atlaspack/workers';
6
7
  import type {StaticRunOpts} from '../RequestTracker';
7
8
  import {requestTypes} from '../RequestTracker';
@@ -63,29 +64,37 @@ async function run({input, api, farm, options}) {
63
64
  |} = {};
64
65
  let writeEarlyPromises = {};
65
66
  let hashRefToNameHash = new Map();
66
- let bundles = bundleGraph.getBundles().filter((bundle) => {
67
- // Do not package and write placeholder bundles to disk. We just
68
- // need to update the name so other bundles can reference it.
69
- if (bundle.isPlaceholder) {
70
- let hash = bundle.id.slice(-8);
71
- hashRefToNameHash.set(bundle.hashReference, hash);
72
- let name = nullthrows(
73
- bundle.name,
74
- `Expected ${bundle.type} bundle to have a name`,
75
- ).replace(bundle.hashReference, hash);
76
- res.set(bundle.id, {
77
- filePath: joinProjectPath(bundle.target.distDir, name),
78
- type: bundle.type, // FIXME: this is wrong if the packager changes the type...
79
- stats: {
80
- time: 0,
81
- size: 0,
82
- },
83
- });
84
- return false;
85
- }
86
67
 
87
- return true;
68
+ // Include inline bundles so that non-inline bundles referenced from inline bundles are written to
69
+ // separate files. This ensures that source maps are written and work.
70
+ const allBundles = bundleGraph.getBundles({
71
+ includeInline: getFeatureFlag('inlineBundlesSourceMapFixes'),
88
72
  });
73
+ const bundles = allBundles
74
+ .filter((bundle) => bundle.bundleBehavior !== 'inline')
75
+ .filter((bundle) => {
76
+ // Do not package and write placeholder bundles to disk. We just
77
+ // need to update the name so other bundles can reference it.
78
+ if (bundle.isPlaceholder) {
79
+ let hash = bundle.id.slice(-8);
80
+ hashRefToNameHash.set(bundle.hashReference, hash);
81
+ let name = nullthrows(
82
+ bundle.name,
83
+ `Expected ${bundle.type} bundle to have a name`,
84
+ ).replace(bundle.hashReference, hash);
85
+ res.set(bundle.id, {
86
+ filePath: joinProjectPath(bundle.target.distDir, name),
87
+ type: bundle.type, // FIXME: this is wrong if the packager changes the type...
88
+ stats: {
89
+ time: 0,
90
+ size: 0,
91
+ },
92
+ });
93
+ return false;
94
+ }
95
+
96
+ return true;
97
+ });
89
98
 
90
99
  // Package on the main thread if there is only one bundle to package.
91
100
  // This avoids the cost of serializing the bundle graph for single file change builds.
@@ -194,7 +203,7 @@ function getBundlesIncludedInHash(
194
203
  included = new Set(),
195
204
  ) {
196
205
  included.add(bundleId);
197
- for (let hashRef of bundleInfoMap[bundleId].hashReferences) {
206
+ for (let hashRef of bundleInfoMap[bundleId]?.hashReferences ?? []) {
198
207
  let referencedId = getIdFromHashRef(hashRef);
199
208
  if (!included.has(referencedId)) {
200
209
  getBundlesIncludedInHash(referencedId, bundleInfoMap, included);