@atlaspack/core 2.13.2-dev.3689 → 2.14.0

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.
Files changed (85) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/package.json +20 -20
  3. package/src/Atlaspack.js +3 -2
  4. package/src/atlaspack-v3/AtlaspackV3.js +25 -9
  5. package/src/requests/WriteBundlesRequest.js +31 -22
  6. package/LICENSE +0 -201
  7. package/lib/AssetGraph.js +0 -521
  8. package/lib/Atlaspack.js +0 -676
  9. package/lib/AtlaspackConfig.js +0 -298
  10. package/lib/AtlaspackConfig.schema.js +0 -103
  11. package/lib/BundleGraph.js +0 -1527
  12. package/lib/CommittedAsset.js +0 -155
  13. package/lib/Dependency.js +0 -136
  14. package/lib/Environment.js +0 -144
  15. package/lib/IdentifierRegistry.js +0 -36
  16. package/lib/InternalConfig.js +0 -56
  17. package/lib/PackagerRunner.js +0 -525
  18. package/lib/ReporterRunner.js +0 -151
  19. package/lib/RequestTracker.js +0 -1178
  20. package/lib/SymbolPropagation.js +0 -618
  21. package/lib/TargetDescriptor.schema.js +0 -118
  22. package/lib/Transformation.js +0 -522
  23. package/lib/UncommittedAsset.js +0 -348
  24. package/lib/Validation.js +0 -203
  25. package/lib/applyRuntimes.js +0 -355
  26. package/lib/assetUtils.js +0 -205
  27. package/lib/atlaspack-v3/AtlaspackV3.js +0 -57
  28. package/lib/atlaspack-v3/NapiWorkerPool.js +0 -71
  29. package/lib/atlaspack-v3/fs.js +0 -39
  30. package/lib/atlaspack-v3/index.js +0 -26
  31. package/lib/atlaspack-v3/jsCallable.js +0 -20
  32. package/lib/atlaspack-v3/worker/compat/asset-symbols.js +0 -197
  33. package/lib/atlaspack-v3/worker/compat/bitflags.js +0 -84
  34. package/lib/atlaspack-v3/worker/compat/dependency.js +0 -44
  35. package/lib/atlaspack-v3/worker/compat/environment.js +0 -57
  36. package/lib/atlaspack-v3/worker/compat/index.js +0 -104
  37. package/lib/atlaspack-v3/worker/compat/mutable-asset.js +0 -164
  38. package/lib/atlaspack-v3/worker/compat/plugin-config.js +0 -78
  39. package/lib/atlaspack-v3/worker/compat/plugin-logger.js +0 -29
  40. package/lib/atlaspack-v3/worker/compat/plugin-options.js +0 -113
  41. package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +0 -12
  42. package/lib/atlaspack-v3/worker/compat/target.js +0 -17
  43. package/lib/atlaspack-v3/worker/index.js +0 -3
  44. package/lib/atlaspack-v3/worker/worker.js +0 -280
  45. package/lib/constants.js +0 -21
  46. package/lib/dumpGraphToGraphViz.js +0 -206
  47. package/lib/index.js +0 -70
  48. package/lib/loadAtlaspackPlugin.js +0 -115
  49. package/lib/loadDotEnv.js +0 -54
  50. package/lib/projectPath.js +0 -112
  51. package/lib/public/Asset.js +0 -259
  52. package/lib/public/Bundle.js +0 -236
  53. package/lib/public/BundleGraph.js +0 -279
  54. package/lib/public/BundleGroup.js +0 -50
  55. package/lib/public/Config.js +0 -202
  56. package/lib/public/Dependency.js +0 -131
  57. package/lib/public/Environment.js +0 -247
  58. package/lib/public/MutableBundleGraph.js +0 -204
  59. package/lib/public/PluginOptions.js +0 -71
  60. package/lib/public/Symbols.js +0 -247
  61. package/lib/public/Target.js +0 -64
  62. package/lib/registerCoreWithSerializer.js +0 -51
  63. package/lib/requests/AssetGraphRequest.js +0 -432
  64. package/lib/requests/AssetGraphRequestRust.js +0 -220
  65. package/lib/requests/AssetRequest.js +0 -132
  66. package/lib/requests/AtlaspackBuildRequest.js +0 -79
  67. package/lib/requests/AtlaspackConfigRequest.js +0 -479
  68. package/lib/requests/BundleGraphRequest.js +0 -485
  69. package/lib/requests/ConfigRequest.js +0 -203
  70. package/lib/requests/DevDepRequest.js +0 -193
  71. package/lib/requests/EntryRequest.js +0 -295
  72. package/lib/requests/PackageRequest.js +0 -88
  73. package/lib/requests/PathRequest.js +0 -357
  74. package/lib/requests/TargetRequest.js +0 -1179
  75. package/lib/requests/ValidationRequest.js +0 -66
  76. package/lib/requests/WriteBundleRequest.js +0 -252
  77. package/lib/requests/WriteBundlesRequest.js +0 -153
  78. package/lib/requests/asset-graph-diff.js +0 -128
  79. package/lib/requests/asset-graph-dot.js +0 -131
  80. package/lib/resolveOptions.js +0 -265
  81. package/lib/serializerCore.browser.js +0 -29
  82. package/lib/summarizeRequest.js +0 -55
  83. package/lib/types.js +0 -35
  84. package/lib/utils.js +0 -160
  85. package/lib/worker.js +0 -184
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.FileSystemV3 = void 0;
7
- var _jsCallable = require("./jsCallable");
8
- class FileSystemV3 {
9
- #fs;
10
- constructor(fs) {
11
- this.#fs = fs;
12
- }
13
- canonicalize = (0, _jsCallable.jsCallable)(path => this.#fs.realpathSync(path));
14
- createDirectory = (0, _jsCallable.jsCallable)(path => this.#fs.mkdirp(path));
15
- cwd = (0, _jsCallable.jsCallable)(() => this.#fs.cwd());
16
- isFile = path => {
17
- try {
18
- return this.#fs.statSync(path).isFile();
19
- } catch {
20
- return false;
21
- }
22
- };
23
- isDir = path => {
24
- try {
25
- return this.#fs.statSync(path).isDirectory();
26
- } catch {
27
- return false;
28
- }
29
- };
30
- readFile = (0, _jsCallable.jsCallable)((path, encoding) => {
31
- if (!encoding) {
32
- // $FlowFixMe
33
- return [...this.#fs.readFileSync(path)];
34
- } else {
35
- return this.#fs.readFileSync(path, encoding);
36
- }
37
- });
38
- }
39
- exports.FileSystemV3 = FileSystemV3;
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "AtlaspackV3", {
7
- enumerable: true,
8
- get: function () {
9
- return _AtlaspackV.AtlaspackV3;
10
- }
11
- });
12
- Object.defineProperty(exports, "FileSystemV3", {
13
- enumerable: true,
14
- get: function () {
15
- return _fs.FileSystemV3;
16
- }
17
- });
18
- Object.defineProperty(exports, "NapiWorkerPool", {
19
- enumerable: true,
20
- get: function () {
21
- return _NapiWorkerPool.NapiWorkerPool;
22
- }
23
- });
24
- var _fs = require("./fs");
25
- var _AtlaspackV = require("./AtlaspackV3");
26
- var _NapiWorkerPool = require("./NapiWorkerPool");
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.jsCallable = jsCallable;
7
- function jsCallable(fn) {
8
- return async (...args) => {
9
- try {
10
- // $FlowFixMe "await" is needed to log the error from
11
- // Promises and is safe to use on non-promises
12
- return await fn(...args);
13
- // $FlowFixMe
14
- } catch (error) {
15
- // eslint-disable-next-line no-console
16
- console.error(error);
17
- throw error;
18
- }
19
- };
20
- }
@@ -1,197 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.MutableDependencySymbols = exports.MutableAssetSymbols = exports.AssetSymbols = void 0;
7
- class MutableDependencySymbols {
8
- #symbols;
9
- #locals;
10
- get isCleared() {
11
- return this.#symbols.size === 0;
12
- }
13
- constructor(inner) {
14
- this.#symbols = new Map();
15
- this.#locals = new Set();
16
- for (const {
17
- exported,
18
- local,
19
- loc,
20
- isWeak
21
- } of inner || []) {
22
- this.set(exported, local, loc, isWeak);
23
- }
24
- }
25
- ensure() {
26
- throw new Error('MutableDependencySymbols.ensure()');
27
- }
28
- get(exportSymbol) {
29
- return this.#symbols.get(exportSymbol);
30
- }
31
- hasExportSymbol(exportSymbol) {
32
- return this.#symbols.has(exportSymbol);
33
- }
34
- hasLocalSymbol(local) {
35
- return this.#locals.has(local);
36
- }
37
- exportSymbols() {
38
- return this.#symbols.keys();
39
- }
40
- set(exportSymbol, local, loc, isWeak) {
41
- this.#locals.add(local);
42
- this.#symbols.set(exportSymbol, {
43
- local,
44
- loc,
45
- meta: {},
46
- isWeak: isWeak ?? false
47
- });
48
- }
49
- delete(exportSymbol) {
50
- let existing = this.#symbols.get(exportSymbol);
51
- if (!existing) return;
52
- this.#locals.delete(existing.local);
53
- this.#symbols.delete(exportSymbol);
54
- }
55
-
56
- /*:: @@iterator(): Iterator<[Symbol, DependencyAssetSymbol]> { return ({}: any); } */
57
- // $FlowFixMe Flow can't do computed properties
58
- [Symbol.iterator]() {
59
- return this.#symbols.values();
60
- }
61
- }
62
- exports.MutableDependencySymbols = MutableDependencySymbols;
63
- class AssetSymbols {
64
- #symbols;
65
- #locals;
66
- get isCleared() {
67
- return this.#symbols.size === 0;
68
- }
69
- constructor(inner) {
70
- this.#symbols = new Map();
71
- this.#locals = new Set();
72
- for (const {
73
- exported,
74
- local,
75
- loc
76
- } of inner || []) {
77
- this.#set(exported, local, loc);
78
- }
79
- }
80
- #set(exportSymbol, local, loc) {
81
- this.#locals.add(local);
82
- this.#symbols.set(exportSymbol, {
83
- local,
84
- loc,
85
- meta: {}
86
- });
87
- }
88
- get(exportSymbol) {
89
- return this.#symbols.get(exportSymbol);
90
- }
91
- hasExportSymbol(exportSymbol) {
92
- return this.#symbols.has(exportSymbol);
93
- }
94
- hasLocalSymbol(local) {
95
- return this.#locals.has(local);
96
- }
97
- exportSymbols() {
98
- return this.#symbols.keys();
99
- }
100
- intoNapi() {
101
- return [];
102
- }
103
-
104
- /*:: @@iterator(): Iterator<[Symbol, AssetSymbol]> { return ({}: any); } */
105
- // $FlowFixMe Flow can't do computed properties
106
- [Symbol.iterator]() {
107
- return this.#symbols.values();
108
- }
109
- }
110
- exports.AssetSymbols = AssetSymbols;
111
- class MutableAssetSymbols {
112
- #symbols;
113
- #locals;
114
- get isCleared() {
115
- return this.#symbols.size === 0;
116
- }
117
- constructor(inner) {
118
- this.#symbols = new Map();
119
- this.#locals = new Set();
120
- for (const {
121
- exported,
122
- loc,
123
- local,
124
- isEsmExport,
125
- selfReferenced
126
- } of inner || []) {
127
- this.set(exported, local, loc, {
128
- isEsm: isEsmExport,
129
- selfReferenced
130
- });
131
- }
132
- }
133
- intoNapi() {
134
- const results = [];
135
- for (const [exportSymbol, {
136
- local,
137
- loc,
138
- meta
139
- }] of this.#symbols.entries()) {
140
- results.push({
141
- exported: exportSymbol,
142
- local,
143
- loc: loc ? {
144
- filePath: loc.filePath,
145
- start: {
146
- line: loc.start.line,
147
- column: loc.start.column
148
- },
149
- end: {
150
- line: loc.end.line,
151
- column: loc.end.column
152
- }
153
- } : undefined,
154
- isEsmExport: Boolean(meta === null || meta === void 0 ? void 0 : meta.isEsm),
155
- isWeak: false,
156
- selfReferenced: Boolean(meta === null || meta === void 0 ? void 0 : meta.selfReferenced)
157
- });
158
- }
159
- return results;
160
- }
161
- ensure() {
162
- throw new Error('MutableAssetSymbols.ensure()');
163
- }
164
- set(exportSymbol, local, loc, meta) {
165
- this.#locals.add(local);
166
- this.#symbols.set(exportSymbol, {
167
- local,
168
- loc,
169
- meta
170
- });
171
- }
172
- get(exportSymbol) {
173
- return this.#symbols.get(exportSymbol);
174
- }
175
- hasExportSymbol(exportSymbol) {
176
- return this.#symbols.has(exportSymbol);
177
- }
178
- hasLocalSymbol(local) {
179
- return this.#locals.has(local);
180
- }
181
- exportSymbols() {
182
- return this.#symbols.keys();
183
- }
184
- delete(exportSymbol) {
185
- let existing = this.#symbols.get(exportSymbol);
186
- if (!existing) return;
187
- this.#locals.delete(existing.local);
188
- this.#symbols.delete(exportSymbol);
189
- }
190
-
191
- /*:: @@iterator(): Iterator<[Symbol, AssetSymbol]> { return ({}: any); } */
192
- // $FlowFixMe Flow can't do computed properties
193
- [Symbol.iterator]() {
194
- return this.#symbols.values();
195
- }
196
- }
197
- exports.MutableAssetSymbols = MutableAssetSymbols;
@@ -1,84 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.specifierTypeMap = exports.packageConditionsMap = exports.dependencyPriorityMap = exports.bundleBehaviorMap = exports.BitFlags = void 0;
7
- /// BitFlags is used to map number/string types from napi types
8
- class BitFlags {
9
- #kv;
10
- #vk;
11
- constructor(source) {
12
- this.#kv = source;
13
- this.#vk = Object.fromEntries(
14
- // $FlowFixMe
15
- Object.entries(source).map(a => a.reverse()));
16
- }
17
- into(key) {
18
- const found = this.#kv[key];
19
- if (found === undefined) {
20
- // $FlowFixMe
21
- throw new Error(`Invalid BundleBehavior(${key})`);
22
- }
23
- return found;
24
- }
25
- intoNullable(key) {
26
- if (key === undefined || key === null) {
27
- return undefined;
28
- }
29
- return this.into(key);
30
- }
31
- intoArray(keys) {
32
- return keys.map(key => this.into(key));
33
- }
34
- from(key) {
35
- const found = this.#vk[key];
36
- if (found === undefined) {
37
- // $FlowFixMe
38
- throw new Error(`Invalid BundleBehavior(${key})`);
39
- }
40
- return found;
41
- }
42
- fromNullable(key) {
43
- if (key === undefined || key === null) {
44
- return undefined;
45
- }
46
- return this.from(key);
47
- }
48
- fromArray(keys) {
49
- return keys.map(key => this.from(key));
50
- }
51
- }
52
- exports.BitFlags = BitFlags;
53
- const bundleBehaviorMap = exports.bundleBehaviorMap = new BitFlags({
54
- inline: 0,
55
- isolated: 1
56
- });
57
- const dependencyPriorityMap = exports.dependencyPriorityMap = new BitFlags({
58
- sync: 0,
59
- parallel: 1,
60
- lazy: 2,
61
- conditional: 3
62
- });
63
- const packageConditionsMap = exports.packageConditionsMap = new BitFlags({
64
- import: 0,
65
- require: 1,
66
- module: 2,
67
- node: 3,
68
- browser: 4,
69
- worker: 5,
70
- worklet: 6,
71
- electron: 7,
72
- development: 8,
73
- production: 9,
74
- types: 10,
75
- default: 11,
76
- style: 12,
77
- sass: 13
78
- });
79
- const specifierTypeMap = exports.specifierTypeMap = new BitFlags({
80
- esm: 0,
81
- commonjs: 1,
82
- url: 2,
83
- custom: 3
84
- });
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Dependency = void 0;
7
- var _target = require("./target");
8
- var _assetSymbols = require("./asset-symbols");
9
- var _bitflags = require("./bitflags");
10
- class Dependency {
11
- get id() {
12
- throw new Error('Dependency.id');
13
- }
14
- constructor(inner, env) {
15
- this.env = env;
16
- this.meta = inner.meta || {};
17
- this.target = undefined;
18
- if (inner.target) {
19
- this.target = new _target.Target(inner.target, this.env);
20
- }
21
- if (!inner.bundleBehavior) {
22
- this.bundleBehavior = undefined;
23
- } else {
24
- this.bundleBehavior = _bitflags.bundleBehaviorMap.from(inner.bundleBehavior);
25
- }
26
- this.bundleBehavior = undefined;
27
- this.symbols = new _assetSymbols.MutableDependencySymbols(inner.symbols || []);
28
- this.specifier = inner.specifier;
29
- this.specifierType = _bitflags.specifierTypeMap.from(inner.specifierType);
30
- this.priority = _bitflags.dependencyPriorityMap.from(inner.priority);
31
- this.needsStableName = inner.needsStableName;
32
- this.isOptional = inner.isOptional;
33
- this.isEntry = inner.isEntry;
34
- this.loc = inner.loc;
35
- this.packageConditions = _bitflags.packageConditionsMap.fromArray(inner.packageConditions || []);
36
- this.sourceAssetId = inner.sourceAssetId;
37
- this.sourcePath = inner.sourcePath;
38
- this.sourceAssetType = inner.sourceAssetType;
39
- this.resolveFrom = inner.resolveFrom ?? inner.sourcePath;
40
- this.range = inner.range;
41
- this.pipeline = inner.pipeline;
42
- }
43
- }
44
- exports.Dependency = Dependency;
@@ -1,57 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Environment = void 0;
7
- class Environment {
8
- constructor(inner) {
9
- // TODO
10
- this.id = '';
11
- this.includeNodeModules = inner.includeNodeModules;
12
- // $FlowFixMe
13
- this.context = inner.context;
14
- this.engines = inner.engines;
15
- // $FlowFixMe
16
- this.outputFormat = inner.outputFormat;
17
- // $FlowFixMe
18
- this.sourceType = inner.sourceType;
19
- this.isLibrary = inner.isLibrary;
20
- this.shouldOptimize = inner.shouldOptimize;
21
- this.shouldScopeHoist = inner.shouldScopeHoist;
22
- this.sourceMap = inner.sourceMap;
23
- this.loc = inner.loc;
24
- this.unstableSingleFileOutput = false;
25
- }
26
- isBrowser() {
27
- return this.context === 'browser' || this.isWorker() || this.isWorklet() || this.context === 'electron-renderer';
28
- }
29
- isNode() {
30
- return this.context === 'node' || this.isElectron();
31
- }
32
- isElectron() {
33
- return this.context === 'electron-main' || this.context === 'electron-renderer';
34
- }
35
- isWorker() {
36
- return this.context === 'web-worker' || this.context === 'service-worker';
37
- }
38
- isWorklet() {
39
- return this.context === 'worklet';
40
- }
41
- isIsolated() {
42
- return this.isWorker() || this.isWorklet();
43
- }
44
-
45
- // TODO
46
- // eslint-disable-next-line no-unused-vars
47
- matchesEngines() {
48
- return true;
49
- }
50
-
51
- // TODO
52
- // eslint-disable-next-line no-unused-vars
53
- supports() {
54
- return true;
55
- }
56
- }
57
- exports.Environment = Environment;
@@ -1,104 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _bitflags = require("./bitflags");
7
- Object.keys(_bitflags).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _bitflags[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _bitflags[key];
14
- }
15
- });
16
- });
17
- var _dependency = require("./dependency");
18
- Object.keys(_dependency).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _dependency[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _dependency[key];
25
- }
26
- });
27
- });
28
- var _environment = require("./environment");
29
- Object.keys(_environment).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _environment[key]) return;
32
- Object.defineProperty(exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _environment[key];
36
- }
37
- });
38
- });
39
- var _target = require("./target");
40
- Object.keys(_target).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _target[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function () {
46
- return _target[key];
47
- }
48
- });
49
- });
50
- var _pluginConfig = require("./plugin-config");
51
- Object.keys(_pluginConfig).forEach(function (key) {
52
- if (key === "default" || key === "__esModule") return;
53
- if (key in exports && exports[key] === _pluginConfig[key]) return;
54
- Object.defineProperty(exports, key, {
55
- enumerable: true,
56
- get: function () {
57
- return _pluginConfig[key];
58
- }
59
- });
60
- });
61
- var _pluginTracer = require("./plugin-tracer");
62
- Object.keys(_pluginTracer).forEach(function (key) {
63
- if (key === "default" || key === "__esModule") return;
64
- if (key in exports && exports[key] === _pluginTracer[key]) return;
65
- Object.defineProperty(exports, key, {
66
- enumerable: true,
67
- get: function () {
68
- return _pluginTracer[key];
69
- }
70
- });
71
- });
72
- var _pluginLogger = require("./plugin-logger");
73
- Object.keys(_pluginLogger).forEach(function (key) {
74
- if (key === "default" || key === "__esModule") return;
75
- if (key in exports && exports[key] === _pluginLogger[key]) return;
76
- Object.defineProperty(exports, key, {
77
- enumerable: true,
78
- get: function () {
79
- return _pluginLogger[key];
80
- }
81
- });
82
- });
83
- var _pluginOptions = require("./plugin-options");
84
- Object.keys(_pluginOptions).forEach(function (key) {
85
- if (key === "default" || key === "__esModule") return;
86
- if (key in exports && exports[key] === _pluginOptions[key]) return;
87
- Object.defineProperty(exports, key, {
88
- enumerable: true,
89
- get: function () {
90
- return _pluginOptions[key];
91
- }
92
- });
93
- });
94
- var _mutableAsset = require("./mutable-asset");
95
- Object.keys(_mutableAsset).forEach(function (key) {
96
- if (key === "default" || key === "__esModule") return;
97
- if (key in exports && exports[key] === _mutableAsset[key]) return;
98
- Object.defineProperty(exports, key, {
99
- enumerable: true,
100
- get: function () {
101
- return _mutableAsset[key];
102
- }
103
- });
104
- });