@atlaspack/core 2.12.1-canary.3354

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 (215) hide show
  1. package/LICENSE +201 -0
  2. package/index.d.ts +22 -0
  3. package/lib/AssetGraph.js +518 -0
  4. package/lib/Atlaspack.js +587 -0
  5. package/lib/AtlaspackConfig.js +298 -0
  6. package/lib/AtlaspackConfig.schema.js +125 -0
  7. package/lib/BundleGraph.js +1445 -0
  8. package/lib/CommittedAsset.js +133 -0
  9. package/lib/Dependency.js +88 -0
  10. package/lib/Environment.js +128 -0
  11. package/lib/InternalConfig.js +48 -0
  12. package/lib/PackagerRunner.js +519 -0
  13. package/lib/ReporterRunner.js +151 -0
  14. package/lib/RequestTracker.js +1089 -0
  15. package/lib/SymbolPropagation.js +625 -0
  16. package/lib/TargetDescriptor.schema.js +115 -0
  17. package/lib/Transformation.js +536 -0
  18. package/lib/UncommittedAsset.js +342 -0
  19. package/lib/Validation.js +215 -0
  20. package/lib/applyRuntimes.js +279 -0
  21. package/lib/assetUtils.js +189 -0
  22. package/lib/atlaspack-v3/AtlaspackV3.js +74 -0
  23. package/lib/atlaspack-v3/fs.js +30 -0
  24. package/lib/atlaspack-v3/index.js +19 -0
  25. package/lib/atlaspack-v3/jsCallable.js +15 -0
  26. package/lib/atlaspack-v3/plugins/Resolver.js +12 -0
  27. package/lib/atlaspack-v3/plugins/index.js +16 -0
  28. package/lib/atlaspack-v3/worker/index.js +3 -0
  29. package/lib/atlaspack-v3/worker/worker.js +30 -0
  30. package/lib/buildCache.js +18 -0
  31. package/lib/constants.js +21 -0
  32. package/lib/dumpGraphToGraphViz.js +206 -0
  33. package/lib/index.js +106 -0
  34. package/lib/loadAtlaspackPlugin.js +148 -0
  35. package/lib/loadDotEnv.js +54 -0
  36. package/lib/projectPath.js +86 -0
  37. package/lib/public/Asset.js +259 -0
  38. package/lib/public/Bundle.js +231 -0
  39. package/lib/public/BundleGraph.js +193 -0
  40. package/lib/public/BundleGroup.js +44 -0
  41. package/lib/public/Config.js +202 -0
  42. package/lib/public/Dependency.js +131 -0
  43. package/lib/public/Environment.js +244 -0
  44. package/lib/public/MutableBundleGraph.js +184 -0
  45. package/lib/public/PluginOptions.js +71 -0
  46. package/lib/public/Symbols.js +247 -0
  47. package/lib/public/Target.js +64 -0
  48. package/lib/registerCoreWithSerializer.js +45 -0
  49. package/lib/requests/AssetGraphRequest.js +427 -0
  50. package/lib/requests/AssetGraphRequestRust.js +187 -0
  51. package/lib/requests/AssetRequest.js +137 -0
  52. package/lib/requests/AtlaspackBuildRequest.js +78 -0
  53. package/lib/requests/AtlaspackConfigRequest.js +473 -0
  54. package/lib/requests/BundleGraphRequest.js +419 -0
  55. package/lib/requests/ConfigRequest.js +198 -0
  56. package/lib/requests/DevDepRequest.js +166 -0
  57. package/lib/requests/EntryRequest.js +295 -0
  58. package/lib/requests/PackageRequest.js +88 -0
  59. package/lib/requests/PathRequest.js +349 -0
  60. package/lib/requests/TargetRequest.js +1177 -0
  61. package/lib/requests/ValidationRequest.js +66 -0
  62. package/lib/requests/WriteBundleRequest.js +252 -0
  63. package/lib/requests/WriteBundlesRequest.js +153 -0
  64. package/lib/resolveOptions.js +234 -0
  65. package/lib/serializer.js +216 -0
  66. package/lib/serializerCore.browser.js +29 -0
  67. package/lib/serializerCore.js +16 -0
  68. package/lib/summarizeRequest.js +55 -0
  69. package/lib/types.js +35 -0
  70. package/lib/utils.js +160 -0
  71. package/lib/worker.js +170 -0
  72. package/package.json +59 -0
  73. package/src/AssetGraph.js +646 -0
  74. package/src/Atlaspack.js +632 -0
  75. package/src/AtlaspackConfig.js +490 -0
  76. package/src/AtlaspackConfig.schema.js +141 -0
  77. package/src/BundleGraph.js +2193 -0
  78. package/src/CommittedAsset.js +143 -0
  79. package/src/Dependency.js +142 -0
  80. package/src/Environment.js +151 -0
  81. package/src/InternalConfig.js +72 -0
  82. package/src/PackagerRunner.js +790 -0
  83. package/src/ReporterRunner.js +158 -0
  84. package/src/RequestTracker.js +1697 -0
  85. package/src/SymbolPropagation.js +794 -0
  86. package/src/TargetDescriptor.schema.js +136 -0
  87. package/src/Transformation.js +752 -0
  88. package/src/UncommittedAsset.js +426 -0
  89. package/src/Validation.js +223 -0
  90. package/src/applyRuntimes.js +341 -0
  91. package/src/assetUtils.js +254 -0
  92. package/src/atlaspack-v3/AtlaspackV3.js +73 -0
  93. package/src/atlaspack-v3/fs.js +36 -0
  94. package/src/atlaspack-v3/index.js +5 -0
  95. package/src/atlaspack-v3/jsCallable.js +13 -0
  96. package/src/atlaspack-v3/plugins/Resolver.js +9 -0
  97. package/src/atlaspack-v3/plugins/index.js +3 -0
  98. package/src/atlaspack-v3/worker/index.js +8 -0
  99. package/src/atlaspack-v3/worker/worker.js +14 -0
  100. package/src/buildCache.js +15 -0
  101. package/src/constants.js +22 -0
  102. package/src/dumpGraphToGraphViz.js +244 -0
  103. package/src/index.js +22 -0
  104. package/src/loadAtlaspackPlugin.js +239 -0
  105. package/src/loadDotEnv.js +56 -0
  106. package/src/projectPath.js +87 -0
  107. package/src/public/Asset.js +359 -0
  108. package/src/public/Bundle.js +337 -0
  109. package/src/public/BundleGraph.js +335 -0
  110. package/src/public/BundleGroup.js +55 -0
  111. package/src/public/Config.js +261 -0
  112. package/src/public/Dependency.js +176 -0
  113. package/src/public/Environment.js +316 -0
  114. package/src/public/MutableBundleGraph.js +320 -0
  115. package/src/public/PluginOptions.js +99 -0
  116. package/src/public/Symbols.js +315 -0
  117. package/src/public/Target.js +71 -0
  118. package/src/registerCoreWithSerializer.js +34 -0
  119. package/src/requests/AssetGraphRequest.js +577 -0
  120. package/src/requests/AssetGraphRequestRust.js +222 -0
  121. package/src/requests/AssetRequest.js +179 -0
  122. package/src/requests/AtlaspackBuildRequest.js +109 -0
  123. package/src/requests/AtlaspackConfigRequest.js +709 -0
  124. package/src/requests/BundleGraphRequest.js +547 -0
  125. package/src/requests/ConfigRequest.js +287 -0
  126. package/src/requests/DevDepRequest.js +246 -0
  127. package/src/requests/EntryRequest.js +385 -0
  128. package/src/requests/PackageRequest.js +105 -0
  129. package/src/requests/PathRequest.js +454 -0
  130. package/src/requests/TargetRequest.js +1632 -0
  131. package/src/requests/ValidationRequest.js +79 -0
  132. package/src/requests/WriteBundleRequest.js +362 -0
  133. package/src/requests/WriteBundlesRequest.js +209 -0
  134. package/src/resolveOptions.js +278 -0
  135. package/src/serializer.js +255 -0
  136. package/src/serializerCore.browser.js +8 -0
  137. package/src/serializerCore.js +5 -0
  138. package/src/summarizeRequest.js +47 -0
  139. package/src/types.js +581 -0
  140. package/src/utils.js +211 -0
  141. package/src/worker.js +189 -0
  142. package/test/AssetGraph.test.js +679 -0
  143. package/test/Atlaspack.test.js +142 -0
  144. package/test/AtlaspackConfig.test.js +405 -0
  145. package/test/AtlaspackConfigRequest.test.js +993 -0
  146. package/test/BundleGraph.test.js +121 -0
  147. package/test/EntryRequest.test.js +215 -0
  148. package/test/Environment.test.js +99 -0
  149. package/test/InternalAsset.test.js +76 -0
  150. package/test/PackagerRunner.test.js +27 -0
  151. package/test/PublicAsset.test.js +40 -0
  152. package/test/PublicBundle.test.js +68 -0
  153. package/test/PublicDependency.test.js +22 -0
  154. package/test/PublicEnvironment.test.js +27 -0
  155. package/test/PublicMutableBundleGraph.test.js +192 -0
  156. package/test/RequestTracker.test.js +448 -0
  157. package/test/SymbolPropagation.test.js +716 -0
  158. package/test/TargetRequest.test.js +1715 -0
  159. package/test/fixtures/application-targets/package.json +3 -0
  160. package/test/fixtures/atlaspack/index.js +1 -0
  161. package/test/fixtures/atlaspack/other.js +3 -0
  162. package/test/fixtures/atlaspack/package.json +1 -0
  163. package/test/fixtures/atlaspack/yarn.lock +0 -0
  164. package/test/fixtures/bundle.js +10 -0
  165. package/test/fixtures/common-targets/package.json +24 -0
  166. package/test/fixtures/common-targets-ignore/package.json +13 -0
  167. package/test/fixtures/config/.atlaspackrc +6 -0
  168. package/test/fixtures/config/subfolder/.atlaspackrc +6 -0
  169. package/test/fixtures/config-extends-not-found/.atlaspackrc +3 -0
  170. package/test/fixtures/config-extends-not-found/.atlaspackrc-json5 +3 -0
  171. package/test/fixtures/config-extends-not-found/.atlaspackrc-multiple +3 -0
  172. package/test/fixtures/config-extends-not-found/.atlaspackrc-node-modules +3 -0
  173. package/test/fixtures/config-malformed/.atlaspackrc +3 -0
  174. package/test/fixtures/config-node-pipeline/.atlaspackrc +6 -0
  175. package/test/fixtures/config-plugin-not-found/.atlaspackrc +6 -0
  176. package/test/fixtures/context/package.json +8 -0
  177. package/test/fixtures/custom-format-infer-ext/package.json +6 -0
  178. package/test/fixtures/custom-format-infer-type/package.json +7 -0
  179. package/test/fixtures/custom-format-mismatch/package.json +8 -0
  180. package/test/fixtures/custom-targets/package.json +20 -0
  181. package/test/fixtures/custom-targets-distdir/package.json +11 -0
  182. package/test/fixtures/duplicate-targets/package.json +4 -0
  183. package/test/fixtures/glob-like/[entry].js +0 -0
  184. package/test/fixtures/invalid-distpath/package.json +11 -0
  185. package/test/fixtures/invalid-engines/package.json +12 -0
  186. package/test/fixtures/invalid-source-missing/package.json +5 -0
  187. package/test/fixtures/invalid-source-not-file/package.json +5 -0
  188. package/test/fixtures/invalid-source-not-file/src/index.js +1 -0
  189. package/test/fixtures/invalid-target-source-missing/package.json +9 -0
  190. package/test/fixtures/invalid-target-source-not-file/package.json +9 -0
  191. package/test/fixtures/invalid-target-source-not-file/src/index.js +1 -0
  192. package/test/fixtures/invalid-targets/package.json +19 -0
  193. package/test/fixtures/library-custom-scopehoist/package.json +9 -0
  194. package/test/fixtures/library-scopehoist/package.json +8 -0
  195. package/test/fixtures/local-plugin-config-pkg/.atlaspackrc +3 -0
  196. package/test/fixtures/local-plugin-config-pkg/node_modules/atlaspack-config-local/index.json +8 -0
  197. package/test/fixtures/local-plugin-config-pkg/node_modules/atlaspack-config-local/local-plugin.js +7 -0
  198. package/test/fixtures/local-plugin-config-pkg/node_modules/atlaspack-config-local/package.json +7 -0
  199. package/test/fixtures/main-format-mismatch/package.json +8 -0
  200. package/test/fixtures/main-global/package.json +8 -0
  201. package/test/fixtures/main-mjs/package.json +8 -0
  202. package/test/fixtures/module-a.js +1 -0
  203. package/test/fixtures/module-b.js +1 -0
  204. package/test/fixtures/plugins/local-plugin.js +7 -0
  205. package/test/fixtures/plugins/node_modules/atlaspack-transformer-bad-engines/index.js +7 -0
  206. package/test/fixtures/plugins/node_modules/atlaspack-transformer-bad-engines/package.json +7 -0
  207. package/test/fixtures/plugins/node_modules/atlaspack-transformer-no-engines/index.js +7 -0
  208. package/test/fixtures/plugins/node_modules/atlaspack-transformer-no-engines/package.json +4 -0
  209. package/test/fixtures/targets-default-distdir-none/package.json +5 -0
  210. package/test/fixtures/targets-default-distdir-one/package.json +8 -0
  211. package/test/fixtures/targets-default-distdir-two/package.json +18 -0
  212. package/test/requests/ConfigRequest.test.js +254 -0
  213. package/test/serializer.test.js +302 -0
  214. package/test/test-utils.js +80 -0
  215. package/test/utils.test.js +43 -0
package/lib/utils.js ADDED
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BuildAbortError = void 0;
7
+ exports.assertSignalNotAborted = assertSignalNotAborted;
8
+ exports.createInvalidations = createInvalidations;
9
+ exports.fromInternalSourceLocation = fromInternalSourceLocation;
10
+ exports.getBundleGroupId = getBundleGroupId;
11
+ exports.getPublicId = getPublicId;
12
+ exports.hashFromOption = hashFromOption;
13
+ exports.invalidateOnFileCreateToInternal = invalidateOnFileCreateToInternal;
14
+ exports.optionsProxy = optionsProxy;
15
+ exports.toInternalSourceLocation = toInternalSourceLocation;
16
+ exports.toInternalSymbols = toInternalSymbols;
17
+ function _assert() {
18
+ const data = _interopRequireDefault(require("assert"));
19
+ _assert = function () {
20
+ return data;
21
+ };
22
+ return data;
23
+ }
24
+ function _baseX() {
25
+ const data = _interopRequireDefault(require("base-x"));
26
+ _baseX = function () {
27
+ return data;
28
+ };
29
+ return data;
30
+ }
31
+ function _utils() {
32
+ const data = require("@atlaspack/utils");
33
+ _utils = function () {
34
+ return data;
35
+ };
36
+ return data;
37
+ }
38
+ var _projectPath = require("./projectPath");
39
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
40
+ const base62 = (0, _baseX().default)('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
41
+ function getBundleGroupId(bundleGroup) {
42
+ return 'bundle_group:' + bundleGroup.target.name + bundleGroup.entryAssetId;
43
+ }
44
+ function assertSignalNotAborted(signal) {
45
+ if (signal && signal.aborted) {
46
+ throw new BuildAbortError();
47
+ }
48
+ }
49
+ class BuildAbortError extends Error {
50
+ name = 'BuildAbortError';
51
+ }
52
+ exports.BuildAbortError = BuildAbortError;
53
+ function getPublicId(id, alreadyExists) {
54
+ let encoded = base62.encode(Buffer.from(id, 'hex'));
55
+ for (let end = 5; end <= encoded.length; end++) {
56
+ let candidate = encoded.slice(0, end);
57
+ if (!alreadyExists(candidate)) {
58
+ return candidate;
59
+ }
60
+ }
61
+ throw new Error('Original id was not unique');
62
+ }
63
+
64
+ // These options don't affect compilation and should cause invalidations
65
+ const ignoreOptions = new Set(['env',
66
+ // handled by separate invalidateOnEnvChange
67
+ 'inputFS', 'outputFS', 'workerFarm', 'packageManager', 'detailedReport', 'shouldDisableCache', 'cacheDir', 'shouldAutoInstall', 'logLevel', 'shouldProfile', 'shouldTrace', 'shouldPatchConsole', 'projectRoot', 'additionalReporters']);
68
+ function optionsProxy(options, invalidateOnOptionChange, addDevDependency) {
69
+ let packageManager = addDevDependency ? proxyPackageManager(options.projectRoot, options.packageManager, addDevDependency) : options.packageManager;
70
+ return new Proxy(options, {
71
+ get(target, prop) {
72
+ if (prop === 'packageManager') {
73
+ return packageManager;
74
+ }
75
+ if (!ignoreOptions.has(prop)) {
76
+ invalidateOnOptionChange(prop);
77
+ }
78
+ return target[prop];
79
+ }
80
+ });
81
+ }
82
+ function proxyPackageManager(projectRoot, packageManager, addDevDependency) {
83
+ let require = (id, from, opts) => {
84
+ addDevDependency({
85
+ specifier: id,
86
+ resolveFrom: (0, _projectPath.toProjectPath)(projectRoot, from),
87
+ range: opts === null || opts === void 0 ? void 0 : opts.range
88
+ });
89
+ return packageManager.require(id, from, opts);
90
+ };
91
+ return new Proxy(packageManager, {
92
+ get(target, prop) {
93
+ if (prop === 'require') {
94
+ return require;
95
+ }
96
+
97
+ // $FlowFixMe
98
+ return target[prop];
99
+ }
100
+ });
101
+ }
102
+ function hashFromOption(value) {
103
+ if (typeof value === 'object' && value != null) {
104
+ return (0, _utils().hashObject)(value);
105
+ }
106
+ return String(value);
107
+ }
108
+ function invalidateOnFileCreateToInternal(projectRoot, invalidation) {
109
+ if (invalidation.glob != null) {
110
+ return {
111
+ glob: (0, _projectPath.toProjectPath)(projectRoot, invalidation.glob)
112
+ };
113
+ } else if (invalidation.filePath != null) {
114
+ return {
115
+ filePath: (0, _projectPath.toProjectPath)(projectRoot, invalidation.filePath)
116
+ };
117
+ } else {
118
+ (0, _assert().default)(invalidation.aboveFilePath != null && invalidation.fileName != null);
119
+ return {
120
+ fileName: invalidation.fileName,
121
+ aboveFilePath: (0, _projectPath.toProjectPath)(projectRoot, invalidation.aboveFilePath)
122
+ };
123
+ }
124
+ }
125
+ function createInvalidations() {
126
+ return {
127
+ invalidateOnBuild: false,
128
+ invalidateOnStartup: false,
129
+ invalidateOnOptionChange: new Set(),
130
+ invalidateOnEnvChange: new Set(),
131
+ invalidateOnFileChange: new Set(),
132
+ invalidateOnFileCreate: []
133
+ };
134
+ }
135
+ function fromInternalSourceLocation(projectRoot, loc) {
136
+ if (!loc) return loc;
137
+ return {
138
+ filePath: (0, _projectPath.fromProjectPath)(projectRoot, loc.filePath),
139
+ start: loc.start,
140
+ end: loc.end
141
+ };
142
+ }
143
+ function toInternalSourceLocation(projectRoot, loc) {
144
+ if (!loc) return loc;
145
+ return {
146
+ filePath: (0, _projectPath.toProjectPath)(projectRoot, loc.filePath),
147
+ start: loc.start,
148
+ end: loc.end
149
+ };
150
+ }
151
+ function toInternalSymbols(projectRoot, symbols) {
152
+ if (!symbols) return symbols;
153
+ return new Map([...symbols].map(([k, {
154
+ loc,
155
+ ...v
156
+ }]) => [k, {
157
+ ...v,
158
+ loc: toInternalSourceLocation(projectRoot, loc)
159
+ }]));
160
+ }
package/lib/worker.js ADDED
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.childInit = childInit;
7
+ exports.clearConfigCache = clearConfigCache;
8
+ exports.invalidateRequireCache = invalidateRequireCache;
9
+ exports.runPackage = runPackage;
10
+ exports.runTransform = runTransform;
11
+ exports.runValidate = runValidate;
12
+ function _utils() {
13
+ const data = require("@atlaspack/utils");
14
+ _utils = function () {
15
+ return data;
16
+ };
17
+ return data;
18
+ }
19
+ function _assert() {
20
+ const data = _interopRequireDefault(require("assert"));
21
+ _assert = function () {
22
+ return data;
23
+ };
24
+ return data;
25
+ }
26
+ function _nullthrows() {
27
+ const data = _interopRequireDefault(require("nullthrows"));
28
+ _nullthrows = function () {
29
+ return data;
30
+ };
31
+ return data;
32
+ }
33
+ var _BundleGraph = _interopRequireDefault(require("./BundleGraph"));
34
+ var _Transformation = _interopRequireDefault(require("./Transformation"));
35
+ var _ReporterRunner = require("./ReporterRunner");
36
+ var _PackagerRunner = _interopRequireDefault(require("./PackagerRunner"));
37
+ var _Validation = _interopRequireDefault(require("./Validation"));
38
+ var _AtlaspackConfig = _interopRequireDefault(require("./AtlaspackConfig"));
39
+ var _registerCoreWithSerializer = require("./registerCoreWithSerializer");
40
+ var _buildCache = require("./buildCache");
41
+ function _sourceMap() {
42
+ const data = require("@parcel/source-map");
43
+ _sourceMap = function () {
44
+ return data;
45
+ };
46
+ return data;
47
+ }
48
+ function _rust() {
49
+ const data = require("@atlaspack/rust");
50
+ _rust = function () {
51
+ return data;
52
+ };
53
+ return data;
54
+ }
55
+ function _workers() {
56
+ const data = _interopRequireDefault(require("@atlaspack/workers"));
57
+ _workers = function () {
58
+ return data;
59
+ };
60
+ return data;
61
+ }
62
+ function _featureFlags() {
63
+ const data = require("@atlaspack/feature-flags");
64
+ _featureFlags = function () {
65
+ return data;
66
+ };
67
+ return data;
68
+ }
69
+ require("@atlaspack/cache");
70
+ require("@atlaspack/package-manager");
71
+ require("@atlaspack/fs");
72
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
73
+ // register with serializer
74
+ // $FlowFixMe
75
+ if (process.env.ATLASPACK_BUILD_REPL && process.browser) {
76
+ /* eslint-disable import/no-extraneous-dependencies, monorepo/no-internal-import */
77
+ require('@atlaspack/repl/src/atlaspack/BrowserPackageManager.js');
78
+ // $FlowFixMe
79
+ require('@atlaspack/repl/src/atlaspack/ExtendedMemoryFS.js');
80
+ /* eslint-enable import/no-extraneous-dependencies, monorepo/no-internal-import */
81
+ }
82
+
83
+ (0, _registerCoreWithSerializer.registerCoreWithSerializer)();
84
+
85
+ // Remove the workerApi type from the TransformationOpts and ValidationOpts types:
86
+ // https://github.com/facebook/flow/issues/2835
87
+ // TODO: this should eventually be replaced by an in memory cache layer
88
+ let atlaspackConfigCache = new Map();
89
+ function loadOptions(ref, workerApi) {
90
+ return (0, _nullthrows().default)(workerApi.getSharedReference(ref
91
+ // $FlowFixMe
92
+ ));
93
+ }
94
+
95
+ async function loadConfig(cachePath, options) {
96
+ let config = atlaspackConfigCache.get(cachePath);
97
+ if (config && config.options === options) {
98
+ return config;
99
+ }
100
+ let processedConfig = (0, _nullthrows().default)(await options.cache.get(cachePath));
101
+ config = new _AtlaspackConfig.default(processedConfig, options);
102
+ atlaspackConfigCache.set(cachePath, config);
103
+ (0, _featureFlags().setFeatureFlags)(options.featureFlags);
104
+ return config;
105
+ }
106
+ function clearConfigCache() {
107
+ _utils().loadConfig.clear();
108
+ (0, _buildCache.clearBuildCaches)();
109
+ }
110
+ async function runTransform(workerApi, opts) {
111
+ let {
112
+ optionsRef,
113
+ configCachePath,
114
+ ...rest
115
+ } = opts;
116
+ let options = loadOptions(optionsRef, workerApi);
117
+ let config = await loadConfig(configCachePath, options);
118
+ return new _Transformation.default({
119
+ workerApi,
120
+ options,
121
+ config,
122
+ ...rest
123
+ }).run();
124
+ }
125
+ async function runValidate(workerApi, opts) {
126
+ let {
127
+ optionsRef,
128
+ configCachePath,
129
+ ...rest
130
+ } = opts;
131
+ let options = loadOptions(optionsRef, workerApi);
132
+ let config = await loadConfig(configCachePath, options);
133
+ return new _Validation.default({
134
+ workerApi,
135
+ report: _ReporterRunner.reportWorker.bind(null, workerApi),
136
+ options,
137
+ config,
138
+ ...rest
139
+ }).run();
140
+ }
141
+ async function runPackage(workerApi, {
142
+ bundle,
143
+ bundleGraphReference,
144
+ configCachePath,
145
+ optionsRef,
146
+ previousDevDeps,
147
+ invalidDevDeps,
148
+ previousInvalidations
149
+ }) {
150
+ let bundleGraph = workerApi.getSharedReference(bundleGraphReference);
151
+ (0, _assert().default)(bundleGraph instanceof _BundleGraph.default);
152
+ let options = loadOptions(optionsRef, workerApi);
153
+ let atlaspackConfig = await loadConfig(configCachePath, options);
154
+ let runner = new _PackagerRunner.default({
155
+ config: atlaspackConfig,
156
+ options,
157
+ report: _workers().default.isWorker() ? _ReporterRunner.reportWorker.bind(null, workerApi) : _ReporterRunner.report,
158
+ previousDevDeps,
159
+ previousInvalidations
160
+ });
161
+ return runner.run(bundleGraph, bundle, invalidDevDeps);
162
+ }
163
+ async function childInit() {
164
+ await _sourceMap().init;
165
+ await (_rust().init === null || _rust().init === void 0 ? void 0 : (0, _rust().init)());
166
+ }
167
+ const PKG_RE = /node_modules[/\\]((?:@[^/\\]+[/\\][^/\\]+)|[^/\\]+)(?!.*[/\\]node_modules[/\\])/;
168
+ function invalidateRequireCache() {
169
+ throw new Error('invalidateRequireCache is only for tests');
170
+ }
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@atlaspack/core",
3
+ "version": "2.12.1-canary.3354+7bb54d46a",
4
+ "license": "MIT",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/atlassian-labs/atlaspack.git"
11
+ },
12
+ "main": "lib/index.js",
13
+ "source": "src/index.js",
14
+ "engines": {
15
+ "node": ">= 16.0.0"
16
+ },
17
+ "scripts": {
18
+ "test": "mocha",
19
+ "test-ci": "mocha",
20
+ "check-ts": "tsc --noEmit index.d.ts"
21
+ },
22
+ "dependencies": {
23
+ "@atlaspack/cache": "2.12.1-canary.3354+7bb54d46a",
24
+ "@atlaspack/diagnostic": "2.12.1-canary.3354+7bb54d46a",
25
+ "@atlaspack/events": "2.12.1-canary.3354+7bb54d46a",
26
+ "@atlaspack/feature-flags": "2.12.1-canary.3354+7bb54d46a",
27
+ "@atlaspack/fs": "2.12.1-canary.3354+7bb54d46a",
28
+ "@atlaspack/graph": "3.2.1-canary.3354+7bb54d46a",
29
+ "@atlaspack/logger": "2.12.1-canary.3354+7bb54d46a",
30
+ "@atlaspack/package-manager": "2.12.1-canary.3354+7bb54d46a",
31
+ "@atlaspack/plugin": "2.12.1-canary.3354+7bb54d46a",
32
+ "@atlaspack/profiler": "2.12.1-canary.3354+7bb54d46a",
33
+ "@atlaspack/rust": "2.12.1-canary.3354+7bb54d46a",
34
+ "@atlaspack/types": "2.12.1-canary.3354+7bb54d46a",
35
+ "@atlaspack/utils": "2.12.1-canary.3354+7bb54d46a",
36
+ "@atlaspack/workers": "2.12.1-canary.3354+7bb54d46a",
37
+ "@mischnic/json-sourcemap": "^0.1.0",
38
+ "@parcel/source-map": "^2.1.1",
39
+ "base-x": "^3.0.8",
40
+ "browserslist": "^4.6.6",
41
+ "clone": "^2.1.1",
42
+ "dotenv": "^7.0.0",
43
+ "dotenv-expand": "^5.1.0",
44
+ "json5": "^2.2.0",
45
+ "msgpackr": "^1.9.9",
46
+ "nullthrows": "^1.1.1",
47
+ "semver": "^7.5.2"
48
+ },
49
+ "devDependencies": {
50
+ "@atlaspack/babel-register": "2.12.0",
51
+ "@types/node": ">= 18",
52
+ "graphviz": "^0.0.9",
53
+ "tempy": "^0.2.1"
54
+ },
55
+ "browser": {
56
+ "./src/serializerCore.js": "./src/serializerCore.browser.js"
57
+ },
58
+ "gitHead": "7bb54d46a00c5ba9cdbc2ee426dcbe82c8d79a3e"
59
+ }