@atlaspack/core 2.12.1-canary.3376 → 2.12.1-canary.3377

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.
@@ -81,7 +81,30 @@ function getAssetGraph(serializedGraph, options) {
81
81
  _nodeIdToContentKey: new Map()
82
82
  });
83
83
  graph.safeToIncrementallyBundle = false;
84
-
84
+ function mapSymbols({
85
+ exported,
86
+ ...symbol
87
+ }) {
88
+ let jsSymbol = {
89
+ local: symbol.local,
90
+ loc: symbol.loc
91
+ };
92
+ if (symbol.isWeak) {
93
+ // $FlowFixMe
94
+ jsSymbol.isWeak = symbol.isWeak;
95
+ }
96
+ if (symbol.exported) {
97
+ // $FlowFixMe
98
+ jsSymbol.exported = symbol.exported;
99
+ }
100
+ if (symbol.isEsmExport) {
101
+ // $FlowFixMe
102
+ jsSymbol.meta = {
103
+ isEsm: true
104
+ };
105
+ }
106
+ return [exported, jsSymbol];
107
+ }
85
108
  // See crates/atlaspack_core/src/types/environment.rs
86
109
  let sourceTypeLookup = {
87
110
  '0': 'module',
@@ -120,10 +143,7 @@ function getAssetGraph(serializedGraph, options) {
120
143
  committed: true,
121
144
  contentKey: id,
122
145
  filePath: (0, _projectPath.toProjectPath)(options.projectRoot, asset.filePath),
123
- symbols: asset.hasSymbols ? new Map(asset.symbols.map(({
124
- exported,
125
- ...symbol
126
- }) => [exported, symbol])) : null
146
+ symbols: asset.hasSymbols ? new Map(asset.symbols.map(mapSymbols)) : null
127
147
  };
128
148
  cachedAssets.set(id, asset.code);
129
149
  changedAssets.set(id, asset);
@@ -148,10 +168,15 @@ function getAssetGraph(serializedGraph, options) {
148
168
  bundleBehavior: dependency.bundleBehavior === 255 ? null : dependency.bundleBehavior,
149
169
  contentKey: id,
150
170
  sourcePath: dependency.sourcePath ? (0, _projectPath.toProjectPath)(options.projectRoot, dependency.sourcePath) : null,
151
- symbols: dependency.hasSymbols ? new Map(dependency.symbols.map(({
152
- exported,
153
- ...symbol
154
- }) => [exported, symbol])) : null
171
+ symbols:
172
+ // Dependency.symbols are always set to an empty map when scope hoisting
173
+ // is enabled. Some tests will fail if this is not the case. We should
174
+ // make this consistant when we re-visit packaging.
175
+ dependency.hasSymbols || dependency.env.shouldScopeHoist ? new Map(dependency.symbols.map(mapSymbols)) : undefined,
176
+ loc: dependency.loc ? {
177
+ ...dependency.loc,
178
+ filePath: (0, _projectPath.toProjectPath)(options.projectRoot, dependency.loc.filePath)
179
+ } : undefined
155
180
  };
156
181
  let usedSymbolsDown = new Set();
157
182
  let usedSymbolsUp = new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.12.1-canary.3376+1fce00015",
3
+ "version": "2.12.1-canary.3377+a23acfda3",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -20,20 +20,20 @@
20
20
  "check-ts": "tsc --noEmit index.d.ts"
21
21
  },
22
22
  "dependencies": {
23
- "@atlaspack/cache": "2.12.1-canary.3376+1fce00015",
24
- "@atlaspack/diagnostic": "2.12.1-canary.3376+1fce00015",
25
- "@atlaspack/events": "2.12.1-canary.3376+1fce00015",
26
- "@atlaspack/feature-flags": "2.12.1-canary.3376+1fce00015",
27
- "@atlaspack/fs": "2.12.1-canary.3376+1fce00015",
28
- "@atlaspack/graph": "3.2.1-canary.3376+1fce00015",
29
- "@atlaspack/logger": "2.12.1-canary.3376+1fce00015",
30
- "@atlaspack/package-manager": "2.12.1-canary.3376+1fce00015",
31
- "@atlaspack/plugin": "2.12.1-canary.3376+1fce00015",
32
- "@atlaspack/profiler": "2.12.1-canary.3376+1fce00015",
33
- "@atlaspack/rust": "2.12.1-canary.3376+1fce00015",
34
- "@atlaspack/types": "2.12.1-canary.3376+1fce00015",
35
- "@atlaspack/utils": "2.12.1-canary.3376+1fce00015",
36
- "@atlaspack/workers": "2.12.1-canary.3376+1fce00015",
23
+ "@atlaspack/cache": "2.12.1-canary.3377+a23acfda3",
24
+ "@atlaspack/diagnostic": "2.12.1-canary.3377+a23acfda3",
25
+ "@atlaspack/events": "2.12.1-canary.3377+a23acfda3",
26
+ "@atlaspack/feature-flags": "2.12.1-canary.3377+a23acfda3",
27
+ "@atlaspack/fs": "2.12.1-canary.3377+a23acfda3",
28
+ "@atlaspack/graph": "3.2.1-canary.3377+a23acfda3",
29
+ "@atlaspack/logger": "2.12.1-canary.3377+a23acfda3",
30
+ "@atlaspack/package-manager": "2.12.1-canary.3377+a23acfda3",
31
+ "@atlaspack/plugin": "2.12.1-canary.3377+a23acfda3",
32
+ "@atlaspack/profiler": "2.12.1-canary.3377+a23acfda3",
33
+ "@atlaspack/rust": "2.12.1-canary.3377+a23acfda3",
34
+ "@atlaspack/types": "2.12.1-canary.3377+a23acfda3",
35
+ "@atlaspack/utils": "2.12.1-canary.3377+a23acfda3",
36
+ "@atlaspack/workers": "2.12.1-canary.3377+a23acfda3",
37
37
  "@mischnic/json-sourcemap": "^0.1.0",
38
38
  "@parcel/source-map": "^2.1.1",
39
39
  "base-x": "^3.0.8",
@@ -55,5 +55,5 @@
55
55
  "browser": {
56
56
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
57
57
  },
58
- "gitHead": "1fce000155c511e503e91511f6bc77a7c402fa31"
58
+ "gitHead": "a23acfda3ced342df606caa384bac157119d33b3"
59
59
  }
@@ -95,6 +95,30 @@ function getAssetGraph(serializedGraph, options) {
95
95
 
96
96
  graph.safeToIncrementallyBundle = false;
97
97
 
98
+ function mapSymbols({exported, ...symbol}) {
99
+ let jsSymbol = {
100
+ local: symbol.local,
101
+ loc: symbol.loc,
102
+ };
103
+
104
+ if (symbol.isWeak) {
105
+ // $FlowFixMe
106
+ jsSymbol.isWeak = symbol.isWeak;
107
+ }
108
+
109
+ if (symbol.exported) {
110
+ // $FlowFixMe
111
+ jsSymbol.exported = symbol.exported;
112
+ }
113
+
114
+ if (symbol.isEsmExport) {
115
+ // $FlowFixMe
116
+ jsSymbol.meta = {
117
+ isEsm: true,
118
+ };
119
+ }
120
+ return [exported, jsSymbol];
121
+ }
98
122
  // See crates/atlaspack_core/src/types/environment.rs
99
123
  let sourceTypeLookup = {'0': 'module', '1': 'script'};
100
124
  let cachedAssets = new Map();
@@ -135,9 +159,7 @@ function getAssetGraph(serializedGraph, options) {
135
159
  contentKey: id,
136
160
  filePath: toProjectPath(options.projectRoot, asset.filePath),
137
161
  symbols: asset.hasSymbols
138
- ? new Map(
139
- asset.symbols.map(({exported, ...symbol}) => [exported, symbol]),
140
- )
162
+ ? new Map(asset.symbols.map(mapSymbols))
141
163
  : null,
142
164
  };
143
165
 
@@ -169,14 +191,22 @@ function getAssetGraph(serializedGraph, options) {
169
191
  sourcePath: dependency.sourcePath
170
192
  ? toProjectPath(options.projectRoot, dependency.sourcePath)
171
193
  : null,
172
- symbols: dependency.hasSymbols
173
- ? new Map(
174
- dependency.symbols.map(({exported, ...symbol}) => [
175
- exported,
176
- symbol,
177
- ]),
178
- )
179
- : null,
194
+ symbols:
195
+ // Dependency.symbols are always set to an empty map when scope hoisting
196
+ // is enabled. Some tests will fail if this is not the case. We should
197
+ // make this consistant when we re-visit packaging.
198
+ dependency.hasSymbols || dependency.env.shouldScopeHoist
199
+ ? new Map(dependency.symbols.map(mapSymbols))
200
+ : undefined,
201
+ loc: dependency.loc
202
+ ? {
203
+ ...dependency.loc,
204
+ filePath: toProjectPath(
205
+ options.projectRoot,
206
+ dependency.loc.filePath,
207
+ ),
208
+ }
209
+ : undefined,
180
210
  };
181
211
  let usedSymbolsDown = new Set();
182
212
  let usedSymbolsUp = new Map();