@atlaspack/core 2.14.0 → 2.14.1-canary.3710

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 (81) hide show
  1. package/LICENSE +201 -0
  2. package/lib/AssetGraph.js +521 -0
  3. package/lib/Atlaspack.js +677 -0
  4. package/lib/AtlaspackConfig.js +298 -0
  5. package/lib/AtlaspackConfig.schema.js +103 -0
  6. package/lib/BundleGraph.js +1527 -0
  7. package/lib/CommittedAsset.js +155 -0
  8. package/lib/Dependency.js +136 -0
  9. package/lib/Environment.js +144 -0
  10. package/lib/IdentifierRegistry.js +36 -0
  11. package/lib/InternalConfig.js +56 -0
  12. package/lib/PackagerRunner.js +525 -0
  13. package/lib/ReporterRunner.js +151 -0
  14. package/lib/RequestTracker.js +1178 -0
  15. package/lib/SymbolPropagation.js +618 -0
  16. package/lib/TargetDescriptor.schema.js +118 -0
  17. package/lib/Transformation.js +522 -0
  18. package/lib/UncommittedAsset.js +348 -0
  19. package/lib/Validation.js +203 -0
  20. package/lib/applyRuntimes.js +355 -0
  21. package/lib/assetUtils.js +205 -0
  22. package/lib/atlaspack-v3/AtlaspackV3.js +66 -0
  23. package/lib/atlaspack-v3/NapiWorkerPool.js +71 -0
  24. package/lib/atlaspack-v3/fs.js +39 -0
  25. package/lib/atlaspack-v3/index.js +26 -0
  26. package/lib/atlaspack-v3/jsCallable.js +20 -0
  27. package/lib/atlaspack-v3/worker/compat/asset-symbols.js +197 -0
  28. package/lib/atlaspack-v3/worker/compat/bitflags.js +84 -0
  29. package/lib/atlaspack-v3/worker/compat/dependency.js +44 -0
  30. package/lib/atlaspack-v3/worker/compat/environment.js +57 -0
  31. package/lib/atlaspack-v3/worker/compat/index.js +104 -0
  32. package/lib/atlaspack-v3/worker/compat/mutable-asset.js +164 -0
  33. package/lib/atlaspack-v3/worker/compat/plugin-config.js +78 -0
  34. package/lib/atlaspack-v3/worker/compat/plugin-logger.js +29 -0
  35. package/lib/atlaspack-v3/worker/compat/plugin-options.js +113 -0
  36. package/lib/atlaspack-v3/worker/compat/plugin-tracer.js +12 -0
  37. package/lib/atlaspack-v3/worker/compat/target.js +17 -0
  38. package/lib/atlaspack-v3/worker/index.js +3 -0
  39. package/lib/atlaspack-v3/worker/worker.js +280 -0
  40. package/lib/constants.js +21 -0
  41. package/lib/dumpGraphToGraphViz.js +206 -0
  42. package/lib/index.js +70 -0
  43. package/lib/loadAtlaspackPlugin.js +115 -0
  44. package/lib/loadDotEnv.js +54 -0
  45. package/lib/projectPath.js +112 -0
  46. package/lib/public/Asset.js +259 -0
  47. package/lib/public/Bundle.js +236 -0
  48. package/lib/public/BundleGraph.js +279 -0
  49. package/lib/public/BundleGroup.js +50 -0
  50. package/lib/public/Config.js +202 -0
  51. package/lib/public/Dependency.js +131 -0
  52. package/lib/public/Environment.js +247 -0
  53. package/lib/public/MutableBundleGraph.js +204 -0
  54. package/lib/public/PluginOptions.js +71 -0
  55. package/lib/public/Symbols.js +247 -0
  56. package/lib/public/Target.js +64 -0
  57. package/lib/registerCoreWithSerializer.js +51 -0
  58. package/lib/requests/AssetGraphRequest.js +432 -0
  59. package/lib/requests/AssetGraphRequestRust.js +220 -0
  60. package/lib/requests/AssetRequest.js +132 -0
  61. package/lib/requests/AtlaspackBuildRequest.js +79 -0
  62. package/lib/requests/AtlaspackConfigRequest.js +479 -0
  63. package/lib/requests/BundleGraphRequest.js +485 -0
  64. package/lib/requests/ConfigRequest.js +203 -0
  65. package/lib/requests/DevDepRequest.js +193 -0
  66. package/lib/requests/EntryRequest.js +295 -0
  67. package/lib/requests/PackageRequest.js +88 -0
  68. package/lib/requests/PathRequest.js +357 -0
  69. package/lib/requests/TargetRequest.js +1179 -0
  70. package/lib/requests/ValidationRequest.js +66 -0
  71. package/lib/requests/WriteBundleRequest.js +252 -0
  72. package/lib/requests/WriteBundlesRequest.js +167 -0
  73. package/lib/requests/asset-graph-diff.js +128 -0
  74. package/lib/requests/asset-graph-dot.js +131 -0
  75. package/lib/resolveOptions.js +265 -0
  76. package/lib/serializerCore.browser.js +29 -0
  77. package/lib/summarizeRequest.js +55 -0
  78. package/lib/types.js +35 -0
  79. package/lib/utils.js +160 -0
  80. package/lib/worker.js +184 -0
  81. package/package.json +20 -19
package/lib/worker.js ADDED
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.childInit = childInit;
7
+ exports.clearWorkerBuildCaches = clearWorkerBuildCaches;
8
+ exports.invalidateRequireCache = invalidateRequireCache;
9
+ exports.ping = ping;
10
+ exports.runPackage = runPackage;
11
+ exports.runTransform = runTransform;
12
+ exports.runValidate = runValidate;
13
+ function _utils() {
14
+ const data = require("@atlaspack/utils");
15
+ _utils = function () {
16
+ return data;
17
+ };
18
+ return data;
19
+ }
20
+ function _assert() {
21
+ const data = _interopRequireDefault(require("assert"));
22
+ _assert = function () {
23
+ return data;
24
+ };
25
+ return data;
26
+ }
27
+ function _nullthrows() {
28
+ const data = _interopRequireDefault(require("nullthrows"));
29
+ _nullthrows = function () {
30
+ return data;
31
+ };
32
+ return data;
33
+ }
34
+ var _BundleGraph = _interopRequireDefault(require("./BundleGraph"));
35
+ var _Transformation = _interopRequireDefault(require("./Transformation"));
36
+ var _ReporterRunner = require("./ReporterRunner");
37
+ var _PackagerRunner = _interopRequireDefault(require("./PackagerRunner"));
38
+ var _Validation = _interopRequireDefault(require("./Validation"));
39
+ var _AtlaspackConfig = require("./AtlaspackConfig");
40
+ var _registerCoreWithSerializer = require("./registerCoreWithSerializer");
41
+ function _buildCache() {
42
+ const data = require("@atlaspack/build-cache");
43
+ _buildCache = function () {
44
+ return data;
45
+ };
46
+ return data;
47
+ }
48
+ function _sourceMap() {
49
+ const data = require("@parcel/source-map");
50
+ _sourceMap = function () {
51
+ return data;
52
+ };
53
+ return data;
54
+ }
55
+ function _rust() {
56
+ const data = require("@atlaspack/rust");
57
+ _rust = function () {
58
+ return data;
59
+ };
60
+ return data;
61
+ }
62
+ function _workers() {
63
+ const data = _interopRequireDefault(require("@atlaspack/workers"));
64
+ _workers = function () {
65
+ return data;
66
+ };
67
+ return data;
68
+ }
69
+ function _featureFlags() {
70
+ const data = require("@atlaspack/feature-flags");
71
+ _featureFlags = function () {
72
+ return data;
73
+ };
74
+ return data;
75
+ }
76
+ require("@atlaspack/cache");
77
+ require("@atlaspack/package-manager");
78
+ require("@atlaspack/fs");
79
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
80
+ // register with serializer
81
+ // $FlowFixMe
82
+ if (process.env.ATLASPACK_BUILD_REPL && process.browser) {
83
+ /* eslint-disable import/no-extraneous-dependencies, monorepo/no-internal-import */
84
+ require('@atlaspack/repl/src/atlaspack/BrowserPackageManager.js');
85
+ // $FlowFixMe
86
+ require('@atlaspack/repl/src/atlaspack/ExtendedMemoryFS.js');
87
+ /* eslint-enable import/no-extraneous-dependencies, monorepo/no-internal-import */
88
+ }
89
+
90
+ (0, _registerCoreWithSerializer.registerCoreWithSerializer)();
91
+
92
+ // Remove the workerApi type from the TransformationOpts and ValidationOpts types:
93
+ // https://github.com/facebook/flow/issues/2835
94
+ // TODO: this should eventually be replaced by an in memory cache layer
95
+ let atlaspackConfigCache = new Map();
96
+ function loadOptions(ref, workerApi) {
97
+ return (0, _nullthrows().default)(workerApi.getSharedReference(ref
98
+ // $FlowFixMe
99
+ ));
100
+ }
101
+
102
+ async function loadConfig(cachePath, options) {
103
+ let config = atlaspackConfigCache.get(cachePath);
104
+ if (config && config.options === options) {
105
+ return config;
106
+ }
107
+ let processedConfig = (0, _nullthrows().default)(await options.cache.get(cachePath));
108
+ config = new _AtlaspackConfig.AtlaspackConfig(processedConfig, options);
109
+ atlaspackConfigCache.set(cachePath, config);
110
+ (0, _featureFlags().setFeatureFlags)(options.featureFlags);
111
+ return config;
112
+ }
113
+ function clearWorkerBuildCaches() {
114
+ _utils().loadConfig.clear();
115
+ (0, _buildCache().clearBuildCaches)();
116
+ }
117
+ async function runTransform(workerApi, opts) {
118
+ let {
119
+ optionsRef,
120
+ configCachePath,
121
+ ...rest
122
+ } = opts;
123
+ let options = loadOptions(optionsRef, workerApi);
124
+ let config = await loadConfig(configCachePath, options);
125
+ return new _Transformation.default({
126
+ workerApi,
127
+ options,
128
+ config,
129
+ ...rest
130
+ }).run();
131
+ }
132
+ async function runValidate(workerApi, opts) {
133
+ let {
134
+ optionsRef,
135
+ configCachePath,
136
+ ...rest
137
+ } = opts;
138
+ let options = loadOptions(optionsRef, workerApi);
139
+ let config = await loadConfig(configCachePath, options);
140
+ return new _Validation.default({
141
+ workerApi,
142
+ report: _ReporterRunner.reportWorker.bind(null, workerApi),
143
+ options,
144
+ config,
145
+ ...rest
146
+ }).run();
147
+ }
148
+ async function runPackage(workerApi, {
149
+ bundle,
150
+ bundleGraphReference,
151
+ configCachePath,
152
+ optionsRef,
153
+ previousDevDeps,
154
+ invalidDevDeps,
155
+ previousInvalidations
156
+ }) {
157
+ let bundleGraph = workerApi.getSharedReference(bundleGraphReference);
158
+ (0, _assert().default)(bundleGraph instanceof _BundleGraph.default);
159
+ let options = loadOptions(optionsRef, workerApi);
160
+ let atlaspackConfig = await loadConfig(configCachePath, options);
161
+ let runner = new _PackagerRunner.default({
162
+ config: atlaspackConfig,
163
+ options,
164
+ report: _workers().default.isWorker() ? _ReporterRunner.reportWorker.bind(null, workerApi) : _ReporterRunner.report,
165
+ previousDevDeps,
166
+ previousInvalidations
167
+ });
168
+ return runner.run(bundleGraph, bundle, invalidDevDeps);
169
+ }
170
+ async function childInit() {
171
+ await _sourceMap().init;
172
+ await (_rust().init === null || _rust().init === void 0 ? void 0 : (0, _rust().init)());
173
+ }
174
+ const PKG_RE = /node_modules[/\\]((?:@[^/\\]+[/\\][^/\\]+)|[^/\\]+)(?!.*[/\\]node_modules[/\\])/;
175
+ function invalidateRequireCache() {
176
+ throw new Error('invalidateRequireCache is only for tests');
177
+ }
178
+
179
+ /**
180
+ * This is used to wait until workers are responding to messages.
181
+ */
182
+ function ping() {
183
+ return true;
184
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaspack/core",
3
- "version": "2.14.0",
3
+ "version": "2.14.1-canary.3710+d874396ab",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -20,22 +20,22 @@
20
20
  "check-ts": "tsc --noEmit index.d.ts"
21
21
  },
22
22
  "dependencies": {
23
+ "@atlaspack/build-cache": "2.13.3-canary.3710+d874396ab",
24
+ "@atlaspack/cache": "2.13.3-canary.3710+d874396ab",
25
+ "@atlaspack/diagnostic": "2.14.1-canary.3710+d874396ab",
26
+ "@atlaspack/events": "2.14.1-canary.3710+d874396ab",
27
+ "@atlaspack/feature-flags": "2.14.1-canary.3710+d874396ab",
28
+ "@atlaspack/fs": "2.14.1-canary.3710+d874396ab",
29
+ "@atlaspack/graph": "3.4.1-canary.3710+d874396ab",
30
+ "@atlaspack/logger": "2.14.1-canary.3710+d874396ab",
31
+ "@atlaspack/package-manager": "2.14.1-canary.3710+d874396ab",
32
+ "@atlaspack/plugin": "2.14.1-canary.3710+d874396ab",
33
+ "@atlaspack/profiler": "2.14.1-canary.3710+d874396ab",
34
+ "@atlaspack/rust": "3.0.1-canary.3710+d874396ab",
35
+ "@atlaspack/types": "2.14.1-canary.3710+d874396ab",
36
+ "@atlaspack/utils": "2.14.1-canary.3710+d874396ab",
37
+ "@atlaspack/workers": "2.14.1-canary.3710+d874396ab",
23
38
  "@mischnic/json-sourcemap": "^0.1.0",
24
- "@atlaspack/build-cache": "2.13.2",
25
- "@atlaspack/cache": "2.13.2",
26
- "@atlaspack/diagnostic": "2.14.0",
27
- "@atlaspack/events": "2.14.0",
28
- "@atlaspack/feature-flags": "2.14.0",
29
- "@atlaspack/fs": "2.14.0",
30
- "@atlaspack/graph": "3.4.0",
31
- "@atlaspack/logger": "2.14.0",
32
- "@atlaspack/package-manager": "2.14.0",
33
- "@atlaspack/plugin": "2.14.0",
34
- "@atlaspack/profiler": "2.14.0",
35
- "@atlaspack/rust": "3.0.0",
36
- "@atlaspack/types": "2.14.0",
37
- "@atlaspack/utils": "2.14.0",
38
- "@atlaspack/workers": "2.14.0",
39
39
  "@parcel/source-map": "^2.1.1",
40
40
  "base-x": "^3.0.8",
41
41
  "browserslist": "^4.6.6",
@@ -50,9 +50,9 @@
50
50
  "devDependencies": {
51
51
  "@atlaspack/babel-register": "2.14.0",
52
52
  "@types/node": ">= 18",
53
- "rfdc": "1",
54
- "jest-diff": "*",
55
53
  "graphviz": "^0.0.9",
54
+ "jest-diff": "*",
55
+ "rfdc": "1",
56
56
  "tempy": "^0.2.1"
57
57
  },
58
58
  "exports": {
@@ -66,5 +66,6 @@
66
66
  "browser": {
67
67
  "./src/serializerCore.js": "./src/serializerCore.browser.js"
68
68
  },
69
- "type": "commonjs"
69
+ "type": "commonjs",
70
+ "gitHead": "d874396ab648d0d5505d66c7eb73e1748f1eaf68"
70
71
  }