@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.
- package/LICENSE +201 -0
- package/index.d.ts +22 -0
- package/lib/AssetGraph.js +518 -0
- package/lib/Atlaspack.js +587 -0
- package/lib/AtlaspackConfig.js +298 -0
- package/lib/AtlaspackConfig.schema.js +125 -0
- package/lib/BundleGraph.js +1445 -0
- package/lib/CommittedAsset.js +133 -0
- package/lib/Dependency.js +88 -0
- package/lib/Environment.js +128 -0
- package/lib/InternalConfig.js +48 -0
- package/lib/PackagerRunner.js +519 -0
- package/lib/ReporterRunner.js +151 -0
- package/lib/RequestTracker.js +1089 -0
- package/lib/SymbolPropagation.js +625 -0
- package/lib/TargetDescriptor.schema.js +115 -0
- package/lib/Transformation.js +536 -0
- package/lib/UncommittedAsset.js +342 -0
- package/lib/Validation.js +215 -0
- package/lib/applyRuntimes.js +279 -0
- package/lib/assetUtils.js +189 -0
- package/lib/atlaspack-v3/AtlaspackV3.js +74 -0
- package/lib/atlaspack-v3/fs.js +30 -0
- package/lib/atlaspack-v3/index.js +19 -0
- package/lib/atlaspack-v3/jsCallable.js +15 -0
- package/lib/atlaspack-v3/plugins/Resolver.js +12 -0
- package/lib/atlaspack-v3/plugins/index.js +16 -0
- package/lib/atlaspack-v3/worker/index.js +3 -0
- package/lib/atlaspack-v3/worker/worker.js +30 -0
- package/lib/buildCache.js +18 -0
- package/lib/constants.js +21 -0
- package/lib/dumpGraphToGraphViz.js +206 -0
- package/lib/index.js +106 -0
- package/lib/loadAtlaspackPlugin.js +148 -0
- package/lib/loadDotEnv.js +54 -0
- package/lib/projectPath.js +86 -0
- package/lib/public/Asset.js +259 -0
- package/lib/public/Bundle.js +231 -0
- package/lib/public/BundleGraph.js +193 -0
- package/lib/public/BundleGroup.js +44 -0
- package/lib/public/Config.js +202 -0
- package/lib/public/Dependency.js +131 -0
- package/lib/public/Environment.js +244 -0
- package/lib/public/MutableBundleGraph.js +184 -0
- package/lib/public/PluginOptions.js +71 -0
- package/lib/public/Symbols.js +247 -0
- package/lib/public/Target.js +64 -0
- package/lib/registerCoreWithSerializer.js +45 -0
- package/lib/requests/AssetGraphRequest.js +427 -0
- package/lib/requests/AssetGraphRequestRust.js +187 -0
- package/lib/requests/AssetRequest.js +137 -0
- package/lib/requests/AtlaspackBuildRequest.js +78 -0
- package/lib/requests/AtlaspackConfigRequest.js +473 -0
- package/lib/requests/BundleGraphRequest.js +419 -0
- package/lib/requests/ConfigRequest.js +198 -0
- package/lib/requests/DevDepRequest.js +166 -0
- package/lib/requests/EntryRequest.js +295 -0
- package/lib/requests/PackageRequest.js +88 -0
- package/lib/requests/PathRequest.js +349 -0
- package/lib/requests/TargetRequest.js +1177 -0
- package/lib/requests/ValidationRequest.js +66 -0
- package/lib/requests/WriteBundleRequest.js +252 -0
- package/lib/requests/WriteBundlesRequest.js +153 -0
- package/lib/resolveOptions.js +234 -0
- package/lib/serializer.js +216 -0
- package/lib/serializerCore.browser.js +29 -0
- package/lib/serializerCore.js +16 -0
- package/lib/summarizeRequest.js +55 -0
- package/lib/types.js +35 -0
- package/lib/utils.js +160 -0
- package/lib/worker.js +170 -0
- package/package.json +59 -0
- package/src/AssetGraph.js +646 -0
- package/src/Atlaspack.js +632 -0
- package/src/AtlaspackConfig.js +490 -0
- package/src/AtlaspackConfig.schema.js +141 -0
- package/src/BundleGraph.js +2193 -0
- package/src/CommittedAsset.js +143 -0
- package/src/Dependency.js +142 -0
- package/src/Environment.js +151 -0
- package/src/InternalConfig.js +72 -0
- package/src/PackagerRunner.js +790 -0
- package/src/ReporterRunner.js +158 -0
- package/src/RequestTracker.js +1697 -0
- package/src/SymbolPropagation.js +794 -0
- package/src/TargetDescriptor.schema.js +136 -0
- package/src/Transformation.js +752 -0
- package/src/UncommittedAsset.js +426 -0
- package/src/Validation.js +223 -0
- package/src/applyRuntimes.js +341 -0
- package/src/assetUtils.js +254 -0
- package/src/atlaspack-v3/AtlaspackV3.js +73 -0
- package/src/atlaspack-v3/fs.js +36 -0
- package/src/atlaspack-v3/index.js +5 -0
- package/src/atlaspack-v3/jsCallable.js +13 -0
- package/src/atlaspack-v3/plugins/Resolver.js +9 -0
- package/src/atlaspack-v3/plugins/index.js +3 -0
- package/src/atlaspack-v3/worker/index.js +8 -0
- package/src/atlaspack-v3/worker/worker.js +14 -0
- package/src/buildCache.js +15 -0
- package/src/constants.js +22 -0
- package/src/dumpGraphToGraphViz.js +244 -0
- package/src/index.js +22 -0
- package/src/loadAtlaspackPlugin.js +239 -0
- package/src/loadDotEnv.js +56 -0
- package/src/projectPath.js +87 -0
- package/src/public/Asset.js +359 -0
- package/src/public/Bundle.js +337 -0
- package/src/public/BundleGraph.js +335 -0
- package/src/public/BundleGroup.js +55 -0
- package/src/public/Config.js +261 -0
- package/src/public/Dependency.js +176 -0
- package/src/public/Environment.js +316 -0
- package/src/public/MutableBundleGraph.js +320 -0
- package/src/public/PluginOptions.js +99 -0
- package/src/public/Symbols.js +315 -0
- package/src/public/Target.js +71 -0
- package/src/registerCoreWithSerializer.js +34 -0
- package/src/requests/AssetGraphRequest.js +577 -0
- package/src/requests/AssetGraphRequestRust.js +222 -0
- package/src/requests/AssetRequest.js +179 -0
- package/src/requests/AtlaspackBuildRequest.js +109 -0
- package/src/requests/AtlaspackConfigRequest.js +709 -0
- package/src/requests/BundleGraphRequest.js +547 -0
- package/src/requests/ConfigRequest.js +287 -0
- package/src/requests/DevDepRequest.js +246 -0
- package/src/requests/EntryRequest.js +385 -0
- package/src/requests/PackageRequest.js +105 -0
- package/src/requests/PathRequest.js +454 -0
- package/src/requests/TargetRequest.js +1632 -0
- package/src/requests/ValidationRequest.js +79 -0
- package/src/requests/WriteBundleRequest.js +362 -0
- package/src/requests/WriteBundlesRequest.js +209 -0
- package/src/resolveOptions.js +278 -0
- package/src/serializer.js +255 -0
- package/src/serializerCore.browser.js +8 -0
- package/src/serializerCore.js +5 -0
- package/src/summarizeRequest.js +47 -0
- package/src/types.js +581 -0
- package/src/utils.js +211 -0
- package/src/worker.js +189 -0
- package/test/AssetGraph.test.js +679 -0
- package/test/Atlaspack.test.js +142 -0
- package/test/AtlaspackConfig.test.js +405 -0
- package/test/AtlaspackConfigRequest.test.js +993 -0
- package/test/BundleGraph.test.js +121 -0
- package/test/EntryRequest.test.js +215 -0
- package/test/Environment.test.js +99 -0
- package/test/InternalAsset.test.js +76 -0
- package/test/PackagerRunner.test.js +27 -0
- package/test/PublicAsset.test.js +40 -0
- package/test/PublicBundle.test.js +68 -0
- package/test/PublicDependency.test.js +22 -0
- package/test/PublicEnvironment.test.js +27 -0
- package/test/PublicMutableBundleGraph.test.js +192 -0
- package/test/RequestTracker.test.js +448 -0
- package/test/SymbolPropagation.test.js +716 -0
- package/test/TargetRequest.test.js +1715 -0
- package/test/fixtures/application-targets/package.json +3 -0
- package/test/fixtures/atlaspack/index.js +1 -0
- package/test/fixtures/atlaspack/other.js +3 -0
- package/test/fixtures/atlaspack/package.json +1 -0
- package/test/fixtures/atlaspack/yarn.lock +0 -0
- package/test/fixtures/bundle.js +10 -0
- package/test/fixtures/common-targets/package.json +24 -0
- package/test/fixtures/common-targets-ignore/package.json +13 -0
- package/test/fixtures/config/.atlaspackrc +6 -0
- package/test/fixtures/config/subfolder/.atlaspackrc +6 -0
- package/test/fixtures/config-extends-not-found/.atlaspackrc +3 -0
- package/test/fixtures/config-extends-not-found/.atlaspackrc-json5 +3 -0
- package/test/fixtures/config-extends-not-found/.atlaspackrc-multiple +3 -0
- package/test/fixtures/config-extends-not-found/.atlaspackrc-node-modules +3 -0
- package/test/fixtures/config-malformed/.atlaspackrc +3 -0
- package/test/fixtures/config-node-pipeline/.atlaspackrc +6 -0
- package/test/fixtures/config-plugin-not-found/.atlaspackrc +6 -0
- package/test/fixtures/context/package.json +8 -0
- package/test/fixtures/custom-format-infer-ext/package.json +6 -0
- package/test/fixtures/custom-format-infer-type/package.json +7 -0
- package/test/fixtures/custom-format-mismatch/package.json +8 -0
- package/test/fixtures/custom-targets/package.json +20 -0
- package/test/fixtures/custom-targets-distdir/package.json +11 -0
- package/test/fixtures/duplicate-targets/package.json +4 -0
- package/test/fixtures/glob-like/[entry].js +0 -0
- package/test/fixtures/invalid-distpath/package.json +11 -0
- package/test/fixtures/invalid-engines/package.json +12 -0
- package/test/fixtures/invalid-source-missing/package.json +5 -0
- package/test/fixtures/invalid-source-not-file/package.json +5 -0
- package/test/fixtures/invalid-source-not-file/src/index.js +1 -0
- package/test/fixtures/invalid-target-source-missing/package.json +9 -0
- package/test/fixtures/invalid-target-source-not-file/package.json +9 -0
- package/test/fixtures/invalid-target-source-not-file/src/index.js +1 -0
- package/test/fixtures/invalid-targets/package.json +19 -0
- package/test/fixtures/library-custom-scopehoist/package.json +9 -0
- package/test/fixtures/library-scopehoist/package.json +8 -0
- package/test/fixtures/local-plugin-config-pkg/.atlaspackrc +3 -0
- package/test/fixtures/local-plugin-config-pkg/node_modules/atlaspack-config-local/index.json +8 -0
- package/test/fixtures/local-plugin-config-pkg/node_modules/atlaspack-config-local/local-plugin.js +7 -0
- package/test/fixtures/local-plugin-config-pkg/node_modules/atlaspack-config-local/package.json +7 -0
- package/test/fixtures/main-format-mismatch/package.json +8 -0
- package/test/fixtures/main-global/package.json +8 -0
- package/test/fixtures/main-mjs/package.json +8 -0
- package/test/fixtures/module-a.js +1 -0
- package/test/fixtures/module-b.js +1 -0
- package/test/fixtures/plugins/local-plugin.js +7 -0
- package/test/fixtures/plugins/node_modules/atlaspack-transformer-bad-engines/index.js +7 -0
- package/test/fixtures/plugins/node_modules/atlaspack-transformer-bad-engines/package.json +7 -0
- package/test/fixtures/plugins/node_modules/atlaspack-transformer-no-engines/index.js +7 -0
- package/test/fixtures/plugins/node_modules/atlaspack-transformer-no-engines/package.json +4 -0
- package/test/fixtures/targets-default-distdir-none/package.json +5 -0
- package/test/fixtures/targets-default-distdir-one/package.json +8 -0
- package/test/fixtures/targets-default-distdir-two/package.json +18 -0
- package/test/requests/ConfigRequest.test.js +254 -0
- package/test/serializer.test.js +302 -0
- package/test/test-utils.js +80 -0
- package/test/utils.test.js +43 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
function _assert() {
|
|
8
|
+
const data = _interopRequireDefault(require("assert"));
|
|
9
|
+
_assert = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _nullthrows() {
|
|
15
|
+
const data = _interopRequireDefault(require("nullthrows"));
|
|
16
|
+
_nullthrows = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _rust() {
|
|
22
|
+
const data = require("@atlaspack/rust");
|
|
23
|
+
_rust = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
var _BundleGraph = _interopRequireDefault(require("./BundleGraph"));
|
|
29
|
+
var _BundleGraph2 = _interopRequireWildcard(require("../BundleGraph"));
|
|
30
|
+
var _Bundle = require("./Bundle");
|
|
31
|
+
var _Asset = require("./Asset");
|
|
32
|
+
var _utils = require("../utils");
|
|
33
|
+
var _Dependency = _interopRequireWildcard(require("./Dependency"));
|
|
34
|
+
var _Environment = require("./Environment");
|
|
35
|
+
var _Target = require("./Target");
|
|
36
|
+
var _constants = require("../constants");
|
|
37
|
+
var _projectPath = require("../projectPath");
|
|
38
|
+
var _types = require("../types");
|
|
39
|
+
var _BundleGroup = _interopRequireWildcard(require("./BundleGroup"));
|
|
40
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
41
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
42
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
43
|
+
class MutableBundleGraph extends _BundleGraph.default {
|
|
44
|
+
#graph /*: InternalBundleGraph */;
|
|
45
|
+
#options /*: AtlaspackOptions */;
|
|
46
|
+
#bundlePublicIds /*: Set<string> */ = new Set();
|
|
47
|
+
constructor(graph, options) {
|
|
48
|
+
super(graph, _Bundle.Bundle.get.bind(_Bundle.Bundle), options);
|
|
49
|
+
this.#graph = graph;
|
|
50
|
+
this.#options = options;
|
|
51
|
+
}
|
|
52
|
+
addAssetToBundle(asset, bundle) {
|
|
53
|
+
this.#graph.addAssetToBundle((0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle));
|
|
54
|
+
}
|
|
55
|
+
addAssetGraphToBundle(asset, bundle, shouldSkipDependency) {
|
|
56
|
+
this.#graph.addAssetGraphToBundle((0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle), shouldSkipDependency ? d => shouldSkipDependency(new _Dependency.default(d, this.#options)) : undefined);
|
|
57
|
+
}
|
|
58
|
+
addEntryToBundle(asset, bundle, shouldSkipDependency) {
|
|
59
|
+
this.#graph.addEntryToBundle((0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle), shouldSkipDependency ? d => shouldSkipDependency(new _Dependency.default(d, this.#options)) : undefined);
|
|
60
|
+
}
|
|
61
|
+
createBundleGroup(dependency, target) {
|
|
62
|
+
let dependencyNode = this.#graph._graph.getNodeByContentKey(dependency.id);
|
|
63
|
+
if (!dependencyNode) {
|
|
64
|
+
throw new Error('Dependency not found');
|
|
65
|
+
}
|
|
66
|
+
(0, _assert().default)(dependencyNode.type === 'dependency');
|
|
67
|
+
let resolved = this.#graph.getResolvedAsset((0, _Dependency.dependencyToInternalDependency)(dependency));
|
|
68
|
+
if (!resolved) {
|
|
69
|
+
throw new Error('Dependency did not resolve to an asset ' + dependency.id);
|
|
70
|
+
}
|
|
71
|
+
let bundleGroup = {
|
|
72
|
+
target: (0, _Target.targetToInternalTarget)(target),
|
|
73
|
+
entryAssetId: resolved.id
|
|
74
|
+
};
|
|
75
|
+
let bundleGroupKey = (0, _utils.getBundleGroupId)(bundleGroup);
|
|
76
|
+
let bundleGroupNodeId = this.#graph._graph.hasContentKey(bundleGroupKey) ? this.#graph._graph.getNodeIdByContentKey(bundleGroupKey) : this.#graph._graph.addNodeByContentKey(bundleGroupKey, {
|
|
77
|
+
id: bundleGroupKey,
|
|
78
|
+
type: 'bundle_group',
|
|
79
|
+
value: bundleGroup
|
|
80
|
+
});
|
|
81
|
+
let dependencyNodeId = this.#graph._graph.getNodeIdByContentKey(dependencyNode.id);
|
|
82
|
+
let resolvedNodeId = this.#graph._graph.getNodeIdByContentKey(resolved.id);
|
|
83
|
+
let assetNodes = this.#graph._graph.getNodeIdsConnectedFrom(dependencyNodeId);
|
|
84
|
+
this.#graph._graph.addEdge(dependencyNodeId, bundleGroupNodeId);
|
|
85
|
+
this.#graph._graph.replaceNodeIdsConnectedTo(bundleGroupNodeId, assetNodes);
|
|
86
|
+
this.#graph._graph.addEdge(dependencyNodeId, resolvedNodeId, _BundleGraph2.bundleGraphEdgeTypes.references);
|
|
87
|
+
if (
|
|
88
|
+
// This check is needed for multiple targets, when we go over the same nodes twice
|
|
89
|
+
this.#graph._graph.hasEdge(dependencyNodeId, resolvedNodeId, _BundleGraph2.bundleGraphEdgeTypes.null)) {
|
|
90
|
+
//nullEdgeType
|
|
91
|
+
this.#graph._graph.removeEdge(dependencyNodeId, resolvedNodeId);
|
|
92
|
+
}
|
|
93
|
+
if (dependency.isEntry) {
|
|
94
|
+
this.#graph._graph.addEdge((0, _nullthrows().default)(this.#graph._graph.rootNodeId), bundleGroupNodeId, _BundleGraph2.bundleGraphEdgeTypes.bundle);
|
|
95
|
+
} else {
|
|
96
|
+
let inboundBundleNodeIds = this.#graph._graph.getNodeIdsConnectedTo(dependencyNodeId, _BundleGraph2.bundleGraphEdgeTypes.contains);
|
|
97
|
+
for (let inboundBundleNodeId of inboundBundleNodeIds) {
|
|
98
|
+
var _this$graph$_graph$ge;
|
|
99
|
+
(0, _assert().default)(((_this$graph$_graph$ge = this.#graph._graph.getNode(inboundBundleNodeId)) === null || _this$graph$_graph$ge === void 0 ? void 0 : _this$graph$_graph$ge.type) === 'bundle');
|
|
100
|
+
this.#graph._graph.addEdge(inboundBundleNodeId, bundleGroupNodeId, _BundleGraph2.bundleGraphEdgeTypes.bundle);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return new _BundleGroup.default(bundleGroup, this.#options);
|
|
104
|
+
}
|
|
105
|
+
removeBundleGroup(bundleGroup) {
|
|
106
|
+
this.#graph.removeBundleGroup((0, _BundleGroup.bundleGroupToInternalBundleGroup)(bundleGroup));
|
|
107
|
+
}
|
|
108
|
+
internalizeAsyncDependency(bundle, dependency) {
|
|
109
|
+
this.#graph.internalizeAsyncDependency((0, _Bundle.bundleToInternalBundle)(bundle), (0, _Dependency.dependencyToInternalDependency)(dependency));
|
|
110
|
+
}
|
|
111
|
+
createBundle(opts) {
|
|
112
|
+
let entryAsset = opts.entryAsset ? (0, _Asset.assetToAssetValue)(opts.entryAsset) : null;
|
|
113
|
+
let target = (0, _Target.targetToInternalTarget)(opts.target);
|
|
114
|
+
let bundleId = (0, _rust().hashString)('bundle:' + (opts.entryAsset ? opts.entryAsset.id : opts.uniqueKey) + (0, _projectPath.fromProjectPathRelative)(target.distDir) + (opts.bundleBehavior ?? ''));
|
|
115
|
+
let existing = this.#graph._graph.getNodeByContentKey(bundleId);
|
|
116
|
+
if (existing != null) {
|
|
117
|
+
(0, _assert().default)(existing.type === 'bundle');
|
|
118
|
+
return _Bundle.Bundle.get(existing.value, this.#graph, this.#options);
|
|
119
|
+
}
|
|
120
|
+
let publicId = (0, _utils.getPublicId)(bundleId, existing => this.#bundlePublicIds.has(existing));
|
|
121
|
+
this.#bundlePublicIds.add(publicId);
|
|
122
|
+
let isPlaceholder = false;
|
|
123
|
+
if (entryAsset) {
|
|
124
|
+
let entryAssetNode = this.#graph._graph.getNodeByContentKey(entryAsset.id);
|
|
125
|
+
(0, _assert().default)((entryAssetNode === null || entryAssetNode === void 0 ? void 0 : entryAssetNode.type) === 'asset', 'Entry asset does not exist');
|
|
126
|
+
isPlaceholder = entryAssetNode.requested === false;
|
|
127
|
+
}
|
|
128
|
+
let bundleNode = {
|
|
129
|
+
type: 'bundle',
|
|
130
|
+
id: bundleId,
|
|
131
|
+
value: {
|
|
132
|
+
id: bundleId,
|
|
133
|
+
hashReference: this.#options.shouldContentHash ? _constants.HASH_REF_PREFIX + bundleId : bundleId.slice(-8),
|
|
134
|
+
type: opts.entryAsset ? opts.entryAsset.type : opts.type,
|
|
135
|
+
env: opts.env ? (0, _Environment.environmentToInternalEnvironment)(opts.env) : (0, _nullthrows().default)(entryAsset).env,
|
|
136
|
+
entryAssetIds: entryAsset ? [entryAsset.id] : [],
|
|
137
|
+
mainEntryId: entryAsset === null || entryAsset === void 0 ? void 0 : entryAsset.id,
|
|
138
|
+
pipeline: opts.entryAsset ? opts.entryAsset.pipeline : opts.pipeline,
|
|
139
|
+
needsStableName: opts.needsStableName,
|
|
140
|
+
bundleBehavior: opts.bundleBehavior != null ? _types.BundleBehavior[opts.bundleBehavior] : null,
|
|
141
|
+
isSplittable: opts.entryAsset ? opts.entryAsset.isBundleSplittable : opts.isSplittable,
|
|
142
|
+
isPlaceholder,
|
|
143
|
+
target,
|
|
144
|
+
name: null,
|
|
145
|
+
displayName: null,
|
|
146
|
+
publicId,
|
|
147
|
+
manualSharedBundle: opts.manualSharedBundle
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
let bundleNodeId = this.#graph._graph.addNodeByContentKey(bundleId, bundleNode);
|
|
151
|
+
if (opts.entryAsset) {
|
|
152
|
+
this.#graph._graph.addEdge(bundleNodeId, this.#graph._graph.getNodeIdByContentKey(opts.entryAsset.id));
|
|
153
|
+
}
|
|
154
|
+
return _Bundle.Bundle.get(bundleNode.value, this.#graph, this.#options);
|
|
155
|
+
}
|
|
156
|
+
addBundleToBundleGroup(bundle, bundleGroup) {
|
|
157
|
+
this.#graph.addBundleToBundleGroup((0, _Bundle.bundleToInternalBundle)(bundle), (0, _BundleGroup.bundleGroupToInternalBundleGroup)(bundleGroup));
|
|
158
|
+
}
|
|
159
|
+
createAssetReference(dependency, asset, bundle) {
|
|
160
|
+
return this.#graph.createAssetReference((0, _Dependency.dependencyToInternalDependency)(dependency), (0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle));
|
|
161
|
+
}
|
|
162
|
+
createBundleReference(from, to) {
|
|
163
|
+
return this.#graph.createBundleReference((0, _Bundle.bundleToInternalBundle)(from), (0, _Bundle.bundleToInternalBundle)(to));
|
|
164
|
+
}
|
|
165
|
+
getDependencyAssets(dependency) {
|
|
166
|
+
return this.#graph.getDependencyAssets((0, _Dependency.dependencyToInternalDependency)(dependency)).map(asset => (0, _Asset.assetFromValue)(asset, this.#options));
|
|
167
|
+
}
|
|
168
|
+
getBundleGroupsContainingBundle(bundle) {
|
|
169
|
+
return this.#graph.getBundleGroupsContainingBundle((0, _Bundle.bundleToInternalBundle)(bundle)).map(bundleGroup => new _BundleGroup.default(bundleGroup, this.#options));
|
|
170
|
+
}
|
|
171
|
+
getParentBundlesOfBundleGroup(bundleGroup) {
|
|
172
|
+
return this.#graph.getParentBundlesOfBundleGroup((0, _BundleGroup.bundleGroupToInternalBundleGroup)(bundleGroup)).map(bundle => _Bundle.Bundle.get(bundle, this.#graph, this.#options));
|
|
173
|
+
}
|
|
174
|
+
getTotalSize(asset) {
|
|
175
|
+
return this.#graph.getTotalSize((0, _Asset.assetToAssetValue)(asset));
|
|
176
|
+
}
|
|
177
|
+
isAssetReachableFromBundle(asset, bundle) {
|
|
178
|
+
return this.#graph.isAssetReachableFromBundle((0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle));
|
|
179
|
+
}
|
|
180
|
+
removeAssetGraphFromBundle(asset, bundle) {
|
|
181
|
+
this.#graph.removeAssetGraphFromBundle((0, _Asset.assetToAssetValue)(asset), (0, _Bundle.bundleToInternalBundle)(bundle));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
exports.default = MutableBundleGraph;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
let atlaspackOptionsToPluginOptions = new WeakMap();
|
|
8
|
+
class PluginOptions {
|
|
9
|
+
#options /*: AtlaspackOptions */;
|
|
10
|
+
|
|
11
|
+
constructor(options) {
|
|
12
|
+
let existing = atlaspackOptionsToPluginOptions.get(options);
|
|
13
|
+
if (existing != null) {
|
|
14
|
+
return existing;
|
|
15
|
+
}
|
|
16
|
+
this.#options = options;
|
|
17
|
+
atlaspackOptionsToPluginOptions.set(options, this);
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
get instanceId() {
|
|
21
|
+
return this.#options.instanceId;
|
|
22
|
+
}
|
|
23
|
+
get mode() {
|
|
24
|
+
return this.#options.mode;
|
|
25
|
+
}
|
|
26
|
+
get env() {
|
|
27
|
+
return this.#options.env;
|
|
28
|
+
}
|
|
29
|
+
get atlaspackVersion() {
|
|
30
|
+
return this.#options.atlaspackVersion;
|
|
31
|
+
}
|
|
32
|
+
get hmrOptions() {
|
|
33
|
+
return this.#options.hmrOptions;
|
|
34
|
+
}
|
|
35
|
+
get serveOptions() {
|
|
36
|
+
return this.#options.serveOptions;
|
|
37
|
+
}
|
|
38
|
+
get shouldBuildLazily() {
|
|
39
|
+
return this.#options.shouldBuildLazily;
|
|
40
|
+
}
|
|
41
|
+
get shouldAutoInstall() {
|
|
42
|
+
return this.#options.shouldAutoInstall;
|
|
43
|
+
}
|
|
44
|
+
get logLevel() {
|
|
45
|
+
return this.#options.logLevel;
|
|
46
|
+
}
|
|
47
|
+
get cacheDir() {
|
|
48
|
+
// TODO: remove this. Probably bad if there are other types of caches.
|
|
49
|
+
// Maybe expose the Cache object instead?
|
|
50
|
+
return this.#options.cacheDir;
|
|
51
|
+
}
|
|
52
|
+
get projectRoot() {
|
|
53
|
+
return this.#options.projectRoot;
|
|
54
|
+
}
|
|
55
|
+
get inputFS() {
|
|
56
|
+
return this.#options.inputFS;
|
|
57
|
+
}
|
|
58
|
+
get outputFS() {
|
|
59
|
+
return this.#options.outputFS;
|
|
60
|
+
}
|
|
61
|
+
get packageManager() {
|
|
62
|
+
return this.#options.packageManager;
|
|
63
|
+
}
|
|
64
|
+
get detailedReport() {
|
|
65
|
+
return this.#options.detailedReport;
|
|
66
|
+
}
|
|
67
|
+
get featureFlags() {
|
|
68
|
+
return this.#options.featureFlags;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.default = PluginOptions;
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MutableDependencySymbols = exports.MutableAssetSymbols = exports.AssetSymbols = void 0;
|
|
7
|
+
function _nullthrows() {
|
|
8
|
+
const data = _interopRequireDefault(require("nullthrows"));
|
|
9
|
+
_nullthrows = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
var _utils = require("../utils");
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
const EMPTY_ITERABLE = {
|
|
17
|
+
[Symbol.iterator]() {
|
|
18
|
+
return EMPTY_ITERATOR;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const EMPTY_ITERATOR = {
|
|
22
|
+
next() {
|
|
23
|
+
return {
|
|
24
|
+
done: true
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const inspect = Symbol.for('nodejs.util.inspect.custom');
|
|
29
|
+
let valueToSymbols = new WeakMap();
|
|
30
|
+
class AssetSymbols {
|
|
31
|
+
/*::
|
|
32
|
+
@@iterator(): Iterator<[ISymbol, {|local: ISymbol, loc: ?SourceLocation, meta?: ?Meta|}]> { return ({}: any); }
|
|
33
|
+
*/
|
|
34
|
+
#value;
|
|
35
|
+
#options;
|
|
36
|
+
constructor(options, asset) {
|
|
37
|
+
let existing = valueToSymbols.get(asset);
|
|
38
|
+
if (existing != null) {
|
|
39
|
+
return existing;
|
|
40
|
+
}
|
|
41
|
+
this.#value = asset;
|
|
42
|
+
this.#options = options;
|
|
43
|
+
valueToSymbols.set(asset, this);
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
hasExportSymbol(exportSymbol) {
|
|
47
|
+
var _this$value$symbols;
|
|
48
|
+
return Boolean((_this$value$symbols = this.#value.symbols) === null || _this$value$symbols === void 0 ? void 0 : _this$value$symbols.has(exportSymbol));
|
|
49
|
+
}
|
|
50
|
+
hasLocalSymbol(local) {
|
|
51
|
+
if (this.#value.symbols == null) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
for (let s of this.#value.symbols.values()) {
|
|
55
|
+
if (local === s.local) return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
get(exportSymbol) {
|
|
60
|
+
var _this$value$symbols2;
|
|
61
|
+
return fromInternalAssetSymbol(this.#options.projectRoot, (_this$value$symbols2 = this.#value.symbols) === null || _this$value$symbols2 === void 0 ? void 0 : _this$value$symbols2.get(exportSymbol));
|
|
62
|
+
}
|
|
63
|
+
get isCleared() {
|
|
64
|
+
return this.#value.symbols == null;
|
|
65
|
+
}
|
|
66
|
+
exportSymbols() {
|
|
67
|
+
var _this$value$symbols3;
|
|
68
|
+
return ((_this$value$symbols3 = this.#value.symbols) === null || _this$value$symbols3 === void 0 ? void 0 : _this$value$symbols3.keys()) ?? [];
|
|
69
|
+
}
|
|
70
|
+
// $FlowFixMe
|
|
71
|
+
[Symbol.iterator]() {
|
|
72
|
+
return this.#value.symbols ? this.#value.symbols[Symbol.iterator]() : EMPTY_ITERATOR;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// $FlowFixMe
|
|
76
|
+
[inspect]() {
|
|
77
|
+
return `AssetSymbols(${this.#value.symbols ? [...this.#value.symbols].map(([s, {
|
|
78
|
+
local
|
|
79
|
+
}]) => `${s}:${local}`).join(', ') : null})`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.AssetSymbols = AssetSymbols;
|
|
83
|
+
let valueToMutableAssetSymbols = new WeakMap();
|
|
84
|
+
class MutableAssetSymbols {
|
|
85
|
+
/*::
|
|
86
|
+
@@iterator(): Iterator<[ISymbol, {|local: ISymbol, loc: ?SourceLocation, meta?: ?Meta|}]> { return ({}: any); }
|
|
87
|
+
*/
|
|
88
|
+
#value;
|
|
89
|
+
#options;
|
|
90
|
+
constructor(options, asset) {
|
|
91
|
+
let existing = valueToMutableAssetSymbols.get(asset);
|
|
92
|
+
if (existing != null) {
|
|
93
|
+
return existing;
|
|
94
|
+
}
|
|
95
|
+
this.#value = asset;
|
|
96
|
+
this.#options = options;
|
|
97
|
+
return this;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// immutable
|
|
101
|
+
|
|
102
|
+
hasExportSymbol(exportSymbol) {
|
|
103
|
+
var _this$value$symbols4;
|
|
104
|
+
return Boolean((_this$value$symbols4 = this.#value.symbols) === null || _this$value$symbols4 === void 0 ? void 0 : _this$value$symbols4.has(exportSymbol));
|
|
105
|
+
}
|
|
106
|
+
hasLocalSymbol(local) {
|
|
107
|
+
if (this.#value.symbols == null) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
for (let s of this.#value.symbols.values()) {
|
|
111
|
+
if (local === s.local) return true;
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
get(exportSymbol) {
|
|
116
|
+
var _this$value$symbols5;
|
|
117
|
+
return fromInternalAssetSymbol(this.#options.projectRoot, (_this$value$symbols5 = this.#value.symbols) === null || _this$value$symbols5 === void 0 ? void 0 : _this$value$symbols5.get(exportSymbol));
|
|
118
|
+
}
|
|
119
|
+
get isCleared() {
|
|
120
|
+
return this.#value.symbols == null;
|
|
121
|
+
}
|
|
122
|
+
exportSymbols() {
|
|
123
|
+
// $FlowFixMe
|
|
124
|
+
return this.#value.symbols.keys();
|
|
125
|
+
}
|
|
126
|
+
// $FlowFixMe
|
|
127
|
+
[Symbol.iterator]() {
|
|
128
|
+
return this.#value.symbols ? this.#value.symbols[Symbol.iterator]() : EMPTY_ITERATOR;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// $FlowFixMe
|
|
132
|
+
[inspect]() {
|
|
133
|
+
return `MutableAssetSymbols(${this.#value.symbols ? [...this.#value.symbols].map(([s, {
|
|
134
|
+
local
|
|
135
|
+
}]) => `${s}:${local}`).join(', ') : null})`;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// mutating
|
|
139
|
+
|
|
140
|
+
ensure() {
|
|
141
|
+
if (this.#value.symbols == null) {
|
|
142
|
+
this.#value.symbols = new Map();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
set(exportSymbol, local, loc, meta) {
|
|
146
|
+
(0, _nullthrows().default)(this.#value.symbols).set(exportSymbol, {
|
|
147
|
+
local,
|
|
148
|
+
loc: (0, _utils.toInternalSourceLocation)(this.#options.projectRoot, loc),
|
|
149
|
+
meta
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
delete(exportSymbol) {
|
|
153
|
+
(0, _nullthrows().default)(this.#value.symbols).delete(exportSymbol);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.MutableAssetSymbols = MutableAssetSymbols;
|
|
157
|
+
let valueToMutableDependencySymbols = new WeakMap();
|
|
158
|
+
class MutableDependencySymbols {
|
|
159
|
+
/*::
|
|
160
|
+
@@iterator(): Iterator<[ISymbol, {|local: ISymbol, loc: ?SourceLocation, isWeak: boolean, meta?: ?Meta|}]> { return ({}: any); }
|
|
161
|
+
*/
|
|
162
|
+
#value;
|
|
163
|
+
#options;
|
|
164
|
+
constructor(options, dep) {
|
|
165
|
+
let existing = valueToMutableDependencySymbols.get(dep);
|
|
166
|
+
if (existing != null) {
|
|
167
|
+
return existing;
|
|
168
|
+
}
|
|
169
|
+
this.#value = dep;
|
|
170
|
+
this.#options = options;
|
|
171
|
+
return this;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// immutable:
|
|
175
|
+
|
|
176
|
+
hasExportSymbol(exportSymbol) {
|
|
177
|
+
var _this$value$symbols6;
|
|
178
|
+
return Boolean((_this$value$symbols6 = this.#value.symbols) === null || _this$value$symbols6 === void 0 ? void 0 : _this$value$symbols6.has(exportSymbol));
|
|
179
|
+
}
|
|
180
|
+
hasLocalSymbol(local) {
|
|
181
|
+
if (this.#value.symbols) {
|
|
182
|
+
for (let s of this.#value.symbols.values()) {
|
|
183
|
+
if (local === s.local) return true;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
get(exportSymbol) {
|
|
189
|
+
return fromInternalDependencySymbol(this.#options.projectRoot, (0, _nullthrows().default)(this.#value.symbols).get(exportSymbol));
|
|
190
|
+
}
|
|
191
|
+
get isCleared() {
|
|
192
|
+
return this.#value.symbols == null;
|
|
193
|
+
}
|
|
194
|
+
exportSymbols() {
|
|
195
|
+
// $FlowFixMe
|
|
196
|
+
return this.#value.symbols ? this.#value.symbols.keys() : EMPTY_ITERABLE;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// $FlowFixMe
|
|
200
|
+
[Symbol.iterator]() {
|
|
201
|
+
return this.#value.symbols ? this.#value.symbols[Symbol.iterator]() : EMPTY_ITERATOR;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// $FlowFixMe
|
|
205
|
+
[inspect]() {
|
|
206
|
+
return `MutableDependencySymbols(${this.#value.symbols ? [...this.#value.symbols].map(([s, {
|
|
207
|
+
local,
|
|
208
|
+
isWeak
|
|
209
|
+
}]) => `${s}:${local}${isWeak ? '?' : ''}`).join(', ') : null})`;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// mutating:
|
|
213
|
+
|
|
214
|
+
ensure() {
|
|
215
|
+
if (this.#value.symbols == null) {
|
|
216
|
+
this.#value.symbols = new Map();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
set(exportSymbol, local, loc, isWeak) {
|
|
220
|
+
var _symbols$get;
|
|
221
|
+
let symbols = (0, _nullthrows().default)(this.#value.symbols);
|
|
222
|
+
symbols.set(exportSymbol, {
|
|
223
|
+
local,
|
|
224
|
+
loc: (0, _utils.toInternalSourceLocation)(this.#options.projectRoot, loc),
|
|
225
|
+
isWeak: (((_symbols$get = symbols.get(exportSymbol)) === null || _symbols$get === void 0 ? void 0 : _symbols$get.isWeak) ?? true) && (isWeak ?? false)
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
delete(exportSymbol) {
|
|
229
|
+
(0, _nullthrows().default)(this.#value.symbols).delete(exportSymbol);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
exports.MutableDependencySymbols = MutableDependencySymbols;
|
|
233
|
+
function fromInternalAssetSymbol(projectRoot, value) {
|
|
234
|
+
return value && {
|
|
235
|
+
local: value.local,
|
|
236
|
+
meta: value.meta,
|
|
237
|
+
loc: (0, _utils.fromInternalSourceLocation)(projectRoot, value.loc)
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function fromInternalDependencySymbol(projectRoot, value) {
|
|
241
|
+
return value && {
|
|
242
|
+
local: value.local,
|
|
243
|
+
meta: value.meta,
|
|
244
|
+
isWeak: value.isWeak,
|
|
245
|
+
loc: (0, _utils.fromInternalSourceLocation)(projectRoot, value.loc)
|
|
246
|
+
};
|
|
247
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
exports.targetToInternalTarget = targetToInternalTarget;
|
|
8
|
+
function _nullthrows() {
|
|
9
|
+
const data = _interopRequireDefault(require("nullthrows"));
|
|
10
|
+
_nullthrows = function () {
|
|
11
|
+
return data;
|
|
12
|
+
};
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
var _Environment = _interopRequireDefault(require("./Environment"));
|
|
16
|
+
var _projectPath = require("../projectPath");
|
|
17
|
+
var _utils = require("../utils");
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
const inspect = Symbol.for('nodejs.util.inspect.custom');
|
|
20
|
+
const internalTargetToTarget = new WeakMap();
|
|
21
|
+
const _targetToInternalTarget = new WeakMap();
|
|
22
|
+
function targetToInternalTarget(target) {
|
|
23
|
+
return (0, _nullthrows().default)(_targetToInternalTarget.get(target));
|
|
24
|
+
}
|
|
25
|
+
class Target {
|
|
26
|
+
#target /*: TargetValue */;
|
|
27
|
+
#options /*: AtlaspackOptions */;
|
|
28
|
+
|
|
29
|
+
constructor(target, options) {
|
|
30
|
+
let existing = internalTargetToTarget.get(target);
|
|
31
|
+
if (existing != null) {
|
|
32
|
+
return existing;
|
|
33
|
+
}
|
|
34
|
+
this.#target = target;
|
|
35
|
+
this.#options = options;
|
|
36
|
+
_targetToInternalTarget.set(this, target);
|
|
37
|
+
internalTargetToTarget.set(target, this);
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
get distEntry() {
|
|
41
|
+
return this.#target.distEntry;
|
|
42
|
+
}
|
|
43
|
+
get distDir() {
|
|
44
|
+
return (0, _projectPath.fromProjectPath)(this.#options.projectRoot, this.#target.distDir);
|
|
45
|
+
}
|
|
46
|
+
get env() {
|
|
47
|
+
return new _Environment.default(this.#target.env, this.#options);
|
|
48
|
+
}
|
|
49
|
+
get name() {
|
|
50
|
+
return this.#target.name;
|
|
51
|
+
}
|
|
52
|
+
get publicUrl() {
|
|
53
|
+
return this.#target.publicUrl;
|
|
54
|
+
}
|
|
55
|
+
get loc() {
|
|
56
|
+
return (0, _utils.fromInternalSourceLocation)(this.#options.projectRoot, this.#target.loc);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// $FlowFixMe[unsupported-syntax]
|
|
60
|
+
[inspect]() {
|
|
61
|
+
return `Target(${this.name} - ${this.env[inspect]()})`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.default = Target;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.registerCoreWithSerializer = registerCoreWithSerializer;
|
|
7
|
+
function _graph() {
|
|
8
|
+
const data = require("@atlaspack/graph");
|
|
9
|
+
_graph = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
var _serializer = require("./serializer");
|
|
15
|
+
var _AssetGraph = _interopRequireDefault(require("./AssetGraph"));
|
|
16
|
+
var _BundleGraph = _interopRequireDefault(require("./BundleGraph"));
|
|
17
|
+
var _AtlaspackConfig = _interopRequireDefault(require("./AtlaspackConfig"));
|
|
18
|
+
var _RequestTracker = require("./RequestTracker");
|
|
19
|
+
var _Config = _interopRequireDefault(require("./public/Config"));
|
|
20
|
+
var _package = _interopRequireDefault(require("../package.json"));
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
+
let coreRegistered;
|
|
23
|
+
function registerCoreWithSerializer() {
|
|
24
|
+
if (coreRegistered) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const packageVersion = _package.default.version;
|
|
28
|
+
if (typeof packageVersion !== 'string') {
|
|
29
|
+
throw new Error('Expected package version to be a string');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// $FlowFixMe[incompatible-cast]
|
|
33
|
+
for (let [name, ctor] of Object.entries({
|
|
34
|
+
AssetGraph: _AssetGraph.default,
|
|
35
|
+
Config: _Config.default,
|
|
36
|
+
BundleGraph: _BundleGraph.default,
|
|
37
|
+
Graph: _graph().Graph,
|
|
38
|
+
AtlaspackConfig: _AtlaspackConfig.default,
|
|
39
|
+
RequestGraph: _RequestTracker.RequestGraph
|
|
40
|
+
// $FlowFixMe[unclear-type]
|
|
41
|
+
})) {
|
|
42
|
+
(0, _serializer.registerSerializableClass)(packageVersion + ':' + name, ctor);
|
|
43
|
+
}
|
|
44
|
+
coreRegistered = true;
|
|
45
|
+
}
|