@atlaspack/core 2.16.2-canary.186 → 2.16.2-canary.189

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.
@@ -154,6 +154,7 @@ class MutableAssetSymbols {
154
154
  }
155
155
  } : undefined,
156
156
  isEsmExport: Boolean(meta === null || meta === void 0 ? void 0 : meta.isEsm),
157
+ isStaticBindingSafe: Boolean(meta === null || meta === void 0 ? void 0 : meta.isStaticBindingSafe),
157
158
  isWeak: false,
158
159
  selfReferenced: Boolean(meta === null || meta === void 0 ? void 0 : meta.selfReferenced)
159
160
  });
@@ -269,6 +269,13 @@ class AtlaspackWorker {
269
269
  }
270
270
  (0, _assert().default)(result.length === 1, '[V3] Unimplemented: Multiple asset return from Node transformer');
271
271
  (0, _assert().default)(result[0] === mutableAsset, '[V3] Unimplemented: New asset returned from Node transformer');
272
+ let assetBuffer = await mutableAsset.getBuffer();
273
+
274
+ // If the asset has no code, we set the buffer to null, which we can
275
+ // detect in Rust, to avoid passing back an empty buffer, which we can't.
276
+ if (assetBuffer.length === 0) {
277
+ assetBuffer = null;
278
+ }
272
279
  return [{
273
280
  id: mutableAsset.id,
274
281
  bundleBehavior: _compat.bundleBehaviorMap.intoNullable(mutableAsset.bundleBehavior),
@@ -284,7 +291,7 @@ class AtlaspackWorker {
284
291
  symbols: mutableAsset.symbols.intoNapi(),
285
292
  type: mutableAsset.type,
286
293
  uniqueKey: mutableAsset.uniqueKey
287
- }, await mutableAsset.getBuffer(),
294
+ }, assetBuffer,
288
295
  // Only send back the map if it has changed
289
296
  mutableAsset.isMapDirty ?
290
297
  // @ts-expect-error TS2533
@@ -99,19 +99,16 @@ function getAssetGraph(serializedGraph) {
99
99
  let jsSymbol = {
100
100
  local: symbol.local ?? undefined,
101
101
  loc: symbol.loc ?? undefined,
102
- meta: undefined,
103
- isWeak: symbol.isWeak
102
+ isWeak: symbol.isWeak,
103
+ meta: {
104
+ isEsm: symbol.isEsmExport,
105
+ isStaticBindingSafe: symbol.isStaticBindingSafe
106
+ }
104
107
  };
105
108
  if (symbol.exported) {
106
109
  // @ts-expect-error TS2339
107
110
  jsSymbol.exported = symbol.exported;
108
111
  }
109
- if (symbol.isEsmExport) {
110
- // @ts-expect-error TS2322
111
- jsSymbol.meta = {
112
- isEsm: true
113
- };
114
- }
115
112
  return [exported, jsSymbol];
116
113
  }
117
114
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.16.2-canary.186+f6532d7a4",
3
+ "version": "2.16.2-canary.189+0684997c1",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -23,21 +23,21 @@
23
23
  "build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
24
24
  },
25
25
  "dependencies": {
26
- "@atlaspack/build-cache": "2.13.3-canary.254+f6532d7a4",
27
- "@atlaspack/cache": "3.1.1-canary.186+f6532d7a4",
28
- "@atlaspack/diagnostic": "2.14.1-canary.254+f6532d7a4",
29
- "@atlaspack/events": "2.14.1-canary.254+f6532d7a4",
30
- "@atlaspack/feature-flags": "2.14.1-canary.254+f6532d7a4",
31
- "@atlaspack/fs": "2.14.5-canary.186+f6532d7a4",
32
- "@atlaspack/graph": "3.4.1-canary.254+f6532d7a4",
33
- "@atlaspack/logger": "2.14.5-canary.186+f6532d7a4",
34
- "@atlaspack/package-manager": "2.14.5-canary.186+f6532d7a4",
35
- "@atlaspack/plugin": "2.14.5-canary.186+f6532d7a4",
36
- "@atlaspack/profiler": "2.14.1-canary.254+f6532d7a4",
37
- "@atlaspack/rust": "3.2.1-canary.186+f6532d7a4",
38
- "@atlaspack/types": "2.14.5-canary.186+f6532d7a4",
39
- "@atlaspack/utils": "2.14.5-canary.186+f6532d7a4",
40
- "@atlaspack/workers": "2.14.5-canary.186+f6532d7a4",
26
+ "@atlaspack/build-cache": "2.13.3-canary.257+0684997c1",
27
+ "@atlaspack/cache": "3.1.1-canary.189+0684997c1",
28
+ "@atlaspack/diagnostic": "2.14.1-canary.257+0684997c1",
29
+ "@atlaspack/events": "2.14.1-canary.257+0684997c1",
30
+ "@atlaspack/feature-flags": "2.14.1-canary.257+0684997c1",
31
+ "@atlaspack/fs": "2.14.5-canary.189+0684997c1",
32
+ "@atlaspack/graph": "3.4.1-canary.257+0684997c1",
33
+ "@atlaspack/logger": "2.14.5-canary.189+0684997c1",
34
+ "@atlaspack/package-manager": "2.14.5-canary.189+0684997c1",
35
+ "@atlaspack/plugin": "2.14.5-canary.189+0684997c1",
36
+ "@atlaspack/profiler": "2.14.1-canary.257+0684997c1",
37
+ "@atlaspack/rust": "3.2.1-canary.189+0684997c1",
38
+ "@atlaspack/types": "2.14.5-canary.189+0684997c1",
39
+ "@atlaspack/utils": "2.14.5-canary.189+0684997c1",
40
+ "@atlaspack/workers": "2.14.5-canary.189+0684997c1",
41
41
  "@mischnic/json-sourcemap": "^0.1.0",
42
42
  "@parcel/source-map": "^2.1.1",
43
43
  "base-x": "^3.0.8",
@@ -62,5 +62,5 @@
62
62
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
63
63
  },
64
64
  "type": "commonjs",
65
- "gitHead": "f6532d7a4f7f007bd4e5e36af04dd466f0b9f572"
65
+ "gitHead": "0684997c127a6204af1376b36e556fddd1ba5557"
66
66
  }
@@ -170,6 +170,7 @@ export class MutableAssetSymbols implements IMutableAssetSymbols {
170
170
  }
171
171
  : undefined,
172
172
  isEsmExport: Boolean(meta?.isEsm),
173
+ isStaticBindingSafe: Boolean(meta?.isStaticBindingSafe),
173
174
  isWeak: false,
174
175
  selfReferenced: Boolean(meta?.selfReferenced),
175
176
  });
@@ -282,6 +282,14 @@ export class AtlaspackWorker {
282
282
  '[V3] Unimplemented: New asset returned from Node transformer',
283
283
  );
284
284
 
285
+ let assetBuffer: Buffer | null = await mutableAsset.getBuffer();
286
+
287
+ // If the asset has no code, we set the buffer to null, which we can
288
+ // detect in Rust, to avoid passing back an empty buffer, which we can't.
289
+ if (assetBuffer.length === 0) {
290
+ assetBuffer = null;
291
+ }
292
+
285
293
  return [
286
294
  {
287
295
  id: mutableAsset.id,
@@ -301,7 +309,7 @@ export class AtlaspackWorker {
301
309
  type: mutableAsset.type,
302
310
  uniqueKey: mutableAsset.uniqueKey,
303
311
  },
304
- await mutableAsset.getBuffer(),
312
+ assetBuffer,
305
313
  // Only send back the map if it has changed
306
314
  mutableAsset.isMapDirty
307
315
  ? // @ts-expect-error TS2533
@@ -96,8 +96,11 @@ export function getAssetGraph(serializedGraph: any): {
96
96
  let jsSymbol = {
97
97
  local: symbol.local ?? undefined,
98
98
  loc: symbol.loc ?? undefined,
99
- meta: undefined,
100
99
  isWeak: symbol.isWeak,
100
+ meta: {
101
+ isEsm: symbol.isEsmExport,
102
+ isStaticBindingSafe: symbol.isStaticBindingSafe,
103
+ },
101
104
  };
102
105
 
103
106
  if (symbol.exported) {
@@ -105,13 +108,6 @@ export function getAssetGraph(serializedGraph: any): {
105
108
  jsSymbol.exported = symbol.exported;
106
109
  }
107
110
 
108
- if (symbol.isEsmExport) {
109
- // @ts-expect-error TS2322
110
- jsSymbol.meta = {
111
- isEsm: true,
112
- };
113
- }
114
-
115
111
  return [exported, jsSymbol];
116
112
  }
117
113