@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,279 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = applyRuntimes;
|
|
7
|
+
function _path() {
|
|
8
|
+
const data = _interopRequireDefault(require("path"));
|
|
9
|
+
_path = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _assert() {
|
|
15
|
+
const data = _interopRequireDefault(require("assert"));
|
|
16
|
+
_assert = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _nullthrows() {
|
|
22
|
+
const data = _interopRequireDefault(require("nullthrows"));
|
|
23
|
+
_nullthrows = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
var _AssetGraph = require("./AssetGraph");
|
|
29
|
+
var _BundleGraph = _interopRequireDefault(require("./public/BundleGraph"));
|
|
30
|
+
var _BundleGraph2 = _interopRequireWildcard(require("./BundleGraph"));
|
|
31
|
+
var _Bundle = require("./public/Bundle");
|
|
32
|
+
function _logger() {
|
|
33
|
+
const data = require("@atlaspack/logger");
|
|
34
|
+
_logger = function () {
|
|
35
|
+
return data;
|
|
36
|
+
};
|
|
37
|
+
return data;
|
|
38
|
+
}
|
|
39
|
+
function _rust() {
|
|
40
|
+
const data = require("@atlaspack/rust");
|
|
41
|
+
_rust = function () {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
return data;
|
|
45
|
+
}
|
|
46
|
+
function _diagnostic() {
|
|
47
|
+
const data = _interopRequireWildcard(require("@atlaspack/diagnostic"));
|
|
48
|
+
_diagnostic = function () {
|
|
49
|
+
return data;
|
|
50
|
+
};
|
|
51
|
+
return data;
|
|
52
|
+
}
|
|
53
|
+
var _Dependency = require("./public/Dependency");
|
|
54
|
+
var _Environment = require("./Environment");
|
|
55
|
+
var _AssetGraphRequest = _interopRequireDefault(require("./requests/AssetGraphRequest"));
|
|
56
|
+
var _DevDepRequest = require("./requests/DevDepRequest");
|
|
57
|
+
var _projectPath = require("./projectPath");
|
|
58
|
+
function _profiler() {
|
|
59
|
+
const data = require("@atlaspack/profiler");
|
|
60
|
+
_profiler = function () {
|
|
61
|
+
return data;
|
|
62
|
+
};
|
|
63
|
+
return data;
|
|
64
|
+
}
|
|
65
|
+
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); }
|
|
66
|
+
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; }
|
|
67
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
68
|
+
function nameRuntimeBundle(bundle, siblingBundle) {
|
|
69
|
+
// We don't run custom namers on runtime bundles as the runtime assumes that they are
|
|
70
|
+
// located at the same nesting level as their owning bundle. Custom naming could
|
|
71
|
+
// be added in future as long as the custom name is validated.
|
|
72
|
+
let {
|
|
73
|
+
hashReference
|
|
74
|
+
} = bundle;
|
|
75
|
+
let name = (0, _nullthrows().default)(siblingBundle.name)
|
|
76
|
+
// Remove the existing hash from standard file patterns
|
|
77
|
+
// e.g. 'main.[hash].js' -> 'main.js' or 'main~[hash].js' -> 'main.js'
|
|
78
|
+
.replace(new RegExp(`[\\.~\\-_]?${siblingBundle.hashReference}`), '')
|
|
79
|
+
// Ensure the file ends with 'runtime.[hash].js'
|
|
80
|
+
.replace(`.${bundle.type}`, `.runtime.${hashReference}.${bundle.type}`);
|
|
81
|
+
bundle.name = name;
|
|
82
|
+
bundle.displayName = name.replace(hashReference, '[hash]');
|
|
83
|
+
}
|
|
84
|
+
async function applyRuntimes({
|
|
85
|
+
bundleGraph,
|
|
86
|
+
config,
|
|
87
|
+
options,
|
|
88
|
+
pluginOptions,
|
|
89
|
+
api,
|
|
90
|
+
optionsRef,
|
|
91
|
+
previousDevDeps,
|
|
92
|
+
devDepRequests,
|
|
93
|
+
configs
|
|
94
|
+
}) {
|
|
95
|
+
let runtimes = await config.getRuntimes();
|
|
96
|
+
let connections = [];
|
|
97
|
+
|
|
98
|
+
// As manifest bundles may be added during runtimes we process them in reverse topological
|
|
99
|
+
// sort order. This allows bundles to be added to their bundle groups before they are referenced
|
|
100
|
+
// by other bundle groups by loader runtimes
|
|
101
|
+
let bundles = [];
|
|
102
|
+
bundleGraph.traverseBundles({
|
|
103
|
+
exit(bundle) {
|
|
104
|
+
bundles.push(bundle);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
for (let bundle of bundles) {
|
|
108
|
+
for (let runtime of runtimes) {
|
|
109
|
+
let measurement;
|
|
110
|
+
try {
|
|
111
|
+
var _configs$get;
|
|
112
|
+
const namedBundle = _Bundle.NamedBundle.get(bundle, bundleGraph, options);
|
|
113
|
+
measurement = _profiler().tracer.createMeasurement(runtime.name, 'applyRuntime', namedBundle.displayName);
|
|
114
|
+
let applied = await runtime.plugin.apply({
|
|
115
|
+
bundle: namedBundle,
|
|
116
|
+
bundleGraph: new _BundleGraph.default(bundleGraph, _Bundle.NamedBundle.get.bind(_Bundle.NamedBundle), options),
|
|
117
|
+
config: (_configs$get = configs.get(runtime.name)) === null || _configs$get === void 0 ? void 0 : _configs$get.result,
|
|
118
|
+
options: pluginOptions,
|
|
119
|
+
logger: new (_logger().PluginLogger)({
|
|
120
|
+
origin: runtime.name
|
|
121
|
+
}),
|
|
122
|
+
tracer: new (_profiler().PluginTracer)({
|
|
123
|
+
origin: runtime.name,
|
|
124
|
+
category: 'applyRuntime'
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
if (applied) {
|
|
128
|
+
let runtimeAssets = Array.isArray(applied) ? applied : [applied];
|
|
129
|
+
for (let {
|
|
130
|
+
code,
|
|
131
|
+
dependency,
|
|
132
|
+
filePath,
|
|
133
|
+
isEntry,
|
|
134
|
+
env,
|
|
135
|
+
priority
|
|
136
|
+
} of runtimeAssets) {
|
|
137
|
+
let sourceName = _path().default.join(_path().default.dirname(filePath), `runtime-${(0, _rust().hashString)(code)}.${bundle.type}`);
|
|
138
|
+
let assetGroup = {
|
|
139
|
+
code,
|
|
140
|
+
filePath: (0, _projectPath.toProjectPath)(options.projectRoot, sourceName),
|
|
141
|
+
env: (0, _Environment.mergeEnvironments)(options.projectRoot, bundle.env, env),
|
|
142
|
+
// Runtime assets should be considered source, as they should be
|
|
143
|
+
// e.g. compiled to run in the target environment
|
|
144
|
+
isSource: true
|
|
145
|
+
};
|
|
146
|
+
let connectionBundle = bundle;
|
|
147
|
+
if (priority === 'parallel' && !bundle.needsStableName) {
|
|
148
|
+
let bundleGroups = bundleGraph.getBundleGroupsContainingBundle(bundle);
|
|
149
|
+
connectionBundle = (0, _nullthrows().default)(bundleGraph.createBundle({
|
|
150
|
+
type: bundle.type,
|
|
151
|
+
needsStableName: false,
|
|
152
|
+
env: bundle.env,
|
|
153
|
+
target: bundle.target,
|
|
154
|
+
uniqueKey: 'runtime-manifest:' + bundle.id,
|
|
155
|
+
shouldContentHash: options.shouldContentHash
|
|
156
|
+
}));
|
|
157
|
+
for (let bundleGroup of bundleGroups) {
|
|
158
|
+
bundleGraph.addBundleToBundleGroup(connectionBundle, bundleGroup);
|
|
159
|
+
}
|
|
160
|
+
bundleGraph.createBundleReference(bundle, connectionBundle);
|
|
161
|
+
nameRuntimeBundle(connectionBundle, bundle);
|
|
162
|
+
}
|
|
163
|
+
connections.push({
|
|
164
|
+
bundle: connectionBundle,
|
|
165
|
+
assetGroup,
|
|
166
|
+
dependency,
|
|
167
|
+
isEntry
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
} catch (e) {
|
|
172
|
+
throw new (_diagnostic().default)({
|
|
173
|
+
diagnostic: (0, _diagnostic().errorToDiagnostic)(e, {
|
|
174
|
+
origin: runtime.name
|
|
175
|
+
})
|
|
176
|
+
});
|
|
177
|
+
} finally {
|
|
178
|
+
measurement && measurement.end();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Correct connection order after generating runtimes in reverse order
|
|
184
|
+
connections.reverse();
|
|
185
|
+
|
|
186
|
+
// Add dev deps for runtime plugins AFTER running them, to account for lazy require().
|
|
187
|
+
for (let runtime of runtimes) {
|
|
188
|
+
let devDepRequest = await (0, _DevDepRequest.createDevDependency)({
|
|
189
|
+
specifier: runtime.name,
|
|
190
|
+
resolveFrom: runtime.resolveFrom
|
|
191
|
+
}, previousDevDeps, options);
|
|
192
|
+
devDepRequests.set(`${devDepRequest.specifier}:${(0, _projectPath.fromProjectPathRelative)(devDepRequest.resolveFrom)}`, devDepRequest);
|
|
193
|
+
await (0, _DevDepRequest.runDevDepRequest)(api, devDepRequest);
|
|
194
|
+
}
|
|
195
|
+
let {
|
|
196
|
+
assetGraph: runtimesAssetGraph,
|
|
197
|
+
changedAssets
|
|
198
|
+
} = await reconcileNewRuntimes(api, connections, optionsRef);
|
|
199
|
+
let runtimesGraph = _BundleGraph2.default.fromAssetGraph(runtimesAssetGraph, options.mode === 'production', bundleGraph._publicIdByAssetId, bundleGraph._assetPublicIds);
|
|
200
|
+
|
|
201
|
+
// Merge the runtimes graph into the main bundle graph.
|
|
202
|
+
bundleGraph.merge(runtimesGraph);
|
|
203
|
+
for (let [assetId, publicId] of runtimesGraph._publicIdByAssetId) {
|
|
204
|
+
bundleGraph._publicIdByAssetId.set(assetId, publicId);
|
|
205
|
+
bundleGraph._assetPublicIds.add(publicId);
|
|
206
|
+
}
|
|
207
|
+
for (let {
|
|
208
|
+
bundle,
|
|
209
|
+
assetGroup,
|
|
210
|
+
dependency,
|
|
211
|
+
isEntry
|
|
212
|
+
} of connections) {
|
|
213
|
+
let assetGroupNode = (0, _AssetGraph.nodeFromAssetGroup)(assetGroup);
|
|
214
|
+
let assetGroupAssetNodeIds = runtimesAssetGraph.getNodeIdsConnectedFrom(runtimesAssetGraph.getNodeIdByContentKey(assetGroupNode.id));
|
|
215
|
+
(0, _assert().default)(assetGroupAssetNodeIds.length === 1);
|
|
216
|
+
let runtimeNodeId = assetGroupAssetNodeIds[0];
|
|
217
|
+
let runtimeNode = (0, _nullthrows().default)(runtimesAssetGraph.getNode(runtimeNodeId));
|
|
218
|
+
(0, _assert().default)(runtimeNode.type === 'asset');
|
|
219
|
+
let resolution = dependency && bundleGraph.getResolvedAsset((0, _Dependency.dependencyToInternalDependency)(dependency), bundle);
|
|
220
|
+
let runtimesGraphRuntimeNodeId = runtimesGraph._graph.getNodeIdByContentKey(runtimeNode.id);
|
|
221
|
+
let duplicatedContentKeys = new Set();
|
|
222
|
+
runtimesGraph._graph.traverse((nodeId, _, actions) => {
|
|
223
|
+
let node = (0, _nullthrows().default)(runtimesGraph._graph.getNode(nodeId));
|
|
224
|
+
if (node.type !== 'dependency') {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
let assets = runtimesGraph._graph.getNodeIdsConnectedFrom(nodeId).map(assetNodeId => {
|
|
228
|
+
let assetNode = (0, _nullthrows().default)(runtimesGraph._graph.getNode(assetNodeId));
|
|
229
|
+
(0, _assert().default)(assetNode.type === 'asset');
|
|
230
|
+
return assetNode.value;
|
|
231
|
+
});
|
|
232
|
+
for (let asset of assets) {
|
|
233
|
+
if (bundleGraph.isAssetReachableFromBundle(asset, bundle) || (resolution === null || resolution === void 0 ? void 0 : resolution.id) === asset.id) {
|
|
234
|
+
duplicatedContentKeys.add(asset.id);
|
|
235
|
+
actions.skipChildren();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}, runtimesGraphRuntimeNodeId);
|
|
239
|
+
let bundleNodeId = bundleGraph._graph.getNodeIdByContentKey(bundle.id);
|
|
240
|
+
let bundleGraphRuntimeNodeId = bundleGraph._graph.getNodeIdByContentKey(runtimeNode.id); // the node id is not constant between graphs
|
|
241
|
+
|
|
242
|
+
runtimesGraph._graph.traverse((nodeId, _, actions) => {
|
|
243
|
+
let node = (0, _nullthrows().default)(runtimesGraph._graph.getNode(nodeId));
|
|
244
|
+
if (node.type === 'asset' || node.type === 'dependency') {
|
|
245
|
+
if (duplicatedContentKeys.has(node.id)) {
|
|
246
|
+
actions.skipChildren();
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const bundleGraphNodeId = bundleGraph._graph.getNodeIdByContentKey(node.id); // the node id is not constant between graphs
|
|
250
|
+
bundleGraph._graph.addEdge(bundleNodeId, bundleGraphNodeId, _BundleGraph2.bundleGraphEdgeTypes.contains);
|
|
251
|
+
}
|
|
252
|
+
}, runtimesGraphRuntimeNodeId);
|
|
253
|
+
if (isEntry) {
|
|
254
|
+
bundleGraph._graph.addEdge(bundleNodeId, bundleGraphRuntimeNodeId);
|
|
255
|
+
bundle.entryAssetIds.unshift(runtimeNode.id);
|
|
256
|
+
}
|
|
257
|
+
if (dependency == null) {
|
|
258
|
+
// Verify this asset won't become an island
|
|
259
|
+
(0, _assert().default)(bundleGraph._graph.getNodeIdsConnectedTo(bundleGraphRuntimeNodeId).length > 0, 'Runtime must have an inbound dependency or be an entry');
|
|
260
|
+
} else {
|
|
261
|
+
let dependencyNodeId = bundleGraph._graph.getNodeIdByContentKey(dependency.id);
|
|
262
|
+
bundleGraph._graph.addEdge(dependencyNodeId, bundleGraphRuntimeNodeId);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return changedAssets;
|
|
266
|
+
}
|
|
267
|
+
function reconcileNewRuntimes(api, connections, optionsRef) {
|
|
268
|
+
let assetGroups = connections.map(t => t.assetGroup);
|
|
269
|
+
let request = (0, _AssetGraphRequest.default)({
|
|
270
|
+
name: 'Runtimes',
|
|
271
|
+
assetGroups,
|
|
272
|
+
optionsRef
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
// rebuild the graph
|
|
276
|
+
return api.runRequest(request, {
|
|
277
|
+
force: true
|
|
278
|
+
});
|
|
279
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createAsset = createAsset;
|
|
7
|
+
exports.createAssetIdFromOptions = createAssetIdFromOptions;
|
|
8
|
+
exports.generateFromAST = generateFromAST;
|
|
9
|
+
exports.getInvalidationHash = getInvalidationHash;
|
|
10
|
+
exports.getInvalidationId = getInvalidationId;
|
|
11
|
+
function _stream() {
|
|
12
|
+
const data = require("stream");
|
|
13
|
+
_stream = function () {
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
function _logger() {
|
|
19
|
+
const data = require("@atlaspack/logger");
|
|
20
|
+
_logger = function () {
|
|
21
|
+
return data;
|
|
22
|
+
};
|
|
23
|
+
return data;
|
|
24
|
+
}
|
|
25
|
+
function _nullthrows() {
|
|
26
|
+
const data = _interopRequireDefault(require("nullthrows"));
|
|
27
|
+
_nullthrows = function () {
|
|
28
|
+
return data;
|
|
29
|
+
};
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
32
|
+
var _CommittedAsset = _interopRequireDefault(require("./CommittedAsset"));
|
|
33
|
+
var _UncommittedAsset = _interopRequireDefault(require("./UncommittedAsset"));
|
|
34
|
+
var _loadAtlaspackPlugin = _interopRequireDefault(require("./loadAtlaspackPlugin"));
|
|
35
|
+
var _Asset = require("./public/Asset");
|
|
36
|
+
var _PluginOptions = _interopRequireDefault(require("./public/PluginOptions"));
|
|
37
|
+
function _utils() {
|
|
38
|
+
const data = require("@atlaspack/utils");
|
|
39
|
+
_utils = function () {
|
|
40
|
+
return data;
|
|
41
|
+
};
|
|
42
|
+
return data;
|
|
43
|
+
}
|
|
44
|
+
var _utils2 = require("./utils");
|
|
45
|
+
var _buildCache = require("./buildCache");
|
|
46
|
+
var _projectPath = require("./projectPath");
|
|
47
|
+
function _rust() {
|
|
48
|
+
const data = require("@atlaspack/rust");
|
|
49
|
+
_rust = function () {
|
|
50
|
+
return data;
|
|
51
|
+
};
|
|
52
|
+
return data;
|
|
53
|
+
}
|
|
54
|
+
var _types = require("./types");
|
|
55
|
+
function _profiler() {
|
|
56
|
+
const data = require("@atlaspack/profiler");
|
|
57
|
+
_profiler = function () {
|
|
58
|
+
return data;
|
|
59
|
+
};
|
|
60
|
+
return data;
|
|
61
|
+
}
|
|
62
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
63
|
+
function createAssetIdFromOptions(options) {
|
|
64
|
+
let uniqueKey = options.uniqueKey ?? '';
|
|
65
|
+
let idBase = options.idBase != null ? options.idBase : (0, _projectPath.fromProjectPathRelative)(options.filePath);
|
|
66
|
+
return (0, _rust().hashString)(idBase + options.type + options.env.id + uniqueKey + ':' + (options.pipeline ?? '') + ':' + (options.query ?? ''));
|
|
67
|
+
}
|
|
68
|
+
function createAsset(projectRoot, options) {
|
|
69
|
+
return {
|
|
70
|
+
id: options.id != null ? options.id : createAssetIdFromOptions(options),
|
|
71
|
+
committed: options.committed ?? false,
|
|
72
|
+
filePath: options.filePath,
|
|
73
|
+
query: options.query,
|
|
74
|
+
bundleBehavior: options.bundleBehavior ? _types.BundleBehavior[options.bundleBehavior] : null,
|
|
75
|
+
isBundleSplittable: options.isBundleSplittable ?? true,
|
|
76
|
+
type: options.type,
|
|
77
|
+
contentKey: options.contentKey,
|
|
78
|
+
mapKey: options.mapKey,
|
|
79
|
+
astKey: options.astKey,
|
|
80
|
+
astGenerator: options.astGenerator,
|
|
81
|
+
dependencies: options.dependencies || new Map(),
|
|
82
|
+
isSource: options.isSource,
|
|
83
|
+
outputHash: options.outputHash,
|
|
84
|
+
pipeline: options.pipeline,
|
|
85
|
+
env: options.env,
|
|
86
|
+
meta: options.meta || {},
|
|
87
|
+
stats: options.stats,
|
|
88
|
+
symbols: options.symbols && new Map([...options.symbols].map(([k, v]) => [k, {
|
|
89
|
+
local: v.local,
|
|
90
|
+
meta: v.meta,
|
|
91
|
+
loc: (0, _utils2.toInternalSourceLocation)(projectRoot, v.loc)
|
|
92
|
+
}])),
|
|
93
|
+
sideEffects: options.sideEffects ?? true,
|
|
94
|
+
uniqueKey: options.uniqueKey,
|
|
95
|
+
plugin: options.plugin,
|
|
96
|
+
configPath: options.configPath,
|
|
97
|
+
configKeyPath: options.configKeyPath
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const generateResults = new WeakMap();
|
|
101
|
+
function generateFromAST(asset) {
|
|
102
|
+
let output = generateResults.get(asset.value);
|
|
103
|
+
if (output == null) {
|
|
104
|
+
output = _generateFromAST(asset);
|
|
105
|
+
generateResults.set(asset.value, output);
|
|
106
|
+
}
|
|
107
|
+
return output;
|
|
108
|
+
}
|
|
109
|
+
async function _generateFromAST(asset) {
|
|
110
|
+
var _plugin$generate;
|
|
111
|
+
let ast = await asset.getAST();
|
|
112
|
+
if (ast == null) {
|
|
113
|
+
throw new Error('Asset has no AST');
|
|
114
|
+
}
|
|
115
|
+
let pluginName = (0, _nullthrows().default)(asset.value.plugin);
|
|
116
|
+
let {
|
|
117
|
+
plugin
|
|
118
|
+
} = await (0, _loadAtlaspackPlugin.default)(pluginName, (0, _projectPath.fromProjectPath)(asset.options.projectRoot, (0, _nullthrows().default)(asset.value.configPath)), (0, _nullthrows().default)(asset.value.configKeyPath), asset.options);
|
|
119
|
+
let generate = (_plugin$generate = plugin.generate) === null || _plugin$generate === void 0 ? void 0 : _plugin$generate.bind(plugin);
|
|
120
|
+
if (!generate) {
|
|
121
|
+
throw new Error(`${pluginName} does not have a generate method`);
|
|
122
|
+
}
|
|
123
|
+
let {
|
|
124
|
+
content,
|
|
125
|
+
map
|
|
126
|
+
} = await generate({
|
|
127
|
+
asset: new _Asset.Asset(asset),
|
|
128
|
+
ast,
|
|
129
|
+
options: new _PluginOptions.default(asset.options),
|
|
130
|
+
logger: new (_logger().PluginLogger)({
|
|
131
|
+
origin: pluginName
|
|
132
|
+
}),
|
|
133
|
+
tracer: new (_profiler().PluginTracer)({
|
|
134
|
+
origin: pluginName,
|
|
135
|
+
category: 'asset-generate'
|
|
136
|
+
})
|
|
137
|
+
});
|
|
138
|
+
let mapBuffer = map === null || map === void 0 ? void 0 : map.toBuffer();
|
|
139
|
+
// Store the results in the cache so we can avoid generating again next time
|
|
140
|
+
await Promise.all([asset.options.cache.setStream((0, _nullthrows().default)(asset.value.contentKey), (0, _utils().blobToStream)(content)), mapBuffer != null && asset.options.cache.setBlob((0, _nullthrows().default)(asset.value.mapKey), mapBuffer)]);
|
|
141
|
+
return {
|
|
142
|
+
content: content instanceof _stream().Readable ? asset.options.cache.getStream((0, _nullthrows().default)(asset.value.contentKey)) : content,
|
|
143
|
+
map
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function getInvalidationId(invalidation) {
|
|
147
|
+
switch (invalidation.type) {
|
|
148
|
+
case 'file':
|
|
149
|
+
return 'file:' + (0, _projectPath.fromProjectPathRelative)(invalidation.filePath);
|
|
150
|
+
case 'env':
|
|
151
|
+
return 'env:' + invalidation.key;
|
|
152
|
+
case 'option':
|
|
153
|
+
return 'option:' + invalidation.key;
|
|
154
|
+
default:
|
|
155
|
+
throw new Error('Unknown invalidation type: ' + invalidation.type);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const hashCache = (0, _buildCache.createBuildCache)();
|
|
159
|
+
async function getInvalidationHash(invalidations, options) {
|
|
160
|
+
if (invalidations.length === 0) {
|
|
161
|
+
return '';
|
|
162
|
+
}
|
|
163
|
+
let sortedInvalidations = invalidations.slice().sort((a, b) => getInvalidationId(a) < getInvalidationId(b) ? -1 : 1);
|
|
164
|
+
let hashes = '';
|
|
165
|
+
for (let invalidation of sortedInvalidations) {
|
|
166
|
+
switch (invalidation.type) {
|
|
167
|
+
case 'file':
|
|
168
|
+
{
|
|
169
|
+
// Only recompute the hash of this file if we haven't seen it already during this build.
|
|
170
|
+
let fileHash = hashCache.get(invalidation.filePath);
|
|
171
|
+
if (fileHash == null) {
|
|
172
|
+
fileHash = (0, _utils().hashFile)(options.inputFS, (0, _projectPath.fromProjectPath)(options.projectRoot, invalidation.filePath));
|
|
173
|
+
hashCache.set(invalidation.filePath, fileHash);
|
|
174
|
+
}
|
|
175
|
+
hashes += await fileHash;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
case 'env':
|
|
179
|
+
hashes += invalidation.key + ':' + (options.env[invalidation.key] || '');
|
|
180
|
+
break;
|
|
181
|
+
case 'option':
|
|
182
|
+
hashes += invalidation.key + ':' + (0, _utils2.hashFromOption)(options[invalidation.key]);
|
|
183
|
+
break;
|
|
184
|
+
default:
|
|
185
|
+
throw new Error('Unknown invalidation type: ' + invalidation.type);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return (0, _rust().hashString)(hashes);
|
|
189
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AtlaspackV3 = void 0;
|
|
7
|
+
function _path() {
|
|
8
|
+
const data = _interopRequireDefault(require("path"));
|
|
9
|
+
_path = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _worker_threads() {
|
|
15
|
+
const data = require("worker_threads");
|
|
16
|
+
_worker_threads = 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
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
|
+
const WORKER_PATH = _path().default.join(__dirname, 'worker', 'index.js');
|
|
30
|
+
class AtlaspackV3 {
|
|
31
|
+
constructor({
|
|
32
|
+
fs,
|
|
33
|
+
nodeWorkers,
|
|
34
|
+
packageManager,
|
|
35
|
+
threads,
|
|
36
|
+
...options
|
|
37
|
+
}) {
|
|
38
|
+
this._internal = new (_rust().AtlaspackNapi)({
|
|
39
|
+
fs,
|
|
40
|
+
nodeWorkers,
|
|
41
|
+
packageManager,
|
|
42
|
+
threads,
|
|
43
|
+
options
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
async build() {
|
|
47
|
+
const [workers, registerWorker] = this.#createWorkers();
|
|
48
|
+
let result = await this._internal.build({
|
|
49
|
+
registerWorker
|
|
50
|
+
});
|
|
51
|
+
for (const worker of workers) worker.terminate();
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
async buildAssetGraph() {
|
|
55
|
+
const [workers, registerWorker] = this.#createWorkers();
|
|
56
|
+
let result = await this._internal.buildAssetGraph({
|
|
57
|
+
registerWorker
|
|
58
|
+
});
|
|
59
|
+
for (const worker of workers) worker.terminate();
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
#createWorkers() {
|
|
63
|
+
const workers = [];
|
|
64
|
+
return [workers, tx_worker => {
|
|
65
|
+
let worker = new (_worker_threads().Worker)(WORKER_PATH, {
|
|
66
|
+
workerData: {
|
|
67
|
+
tx_worker
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
workers.push(worker);
|
|
71
|
+
}];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.AtlaspackV3 = AtlaspackV3;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toFileSystemV3 = toFileSystemV3;
|
|
7
|
+
var _jsCallable = require("./jsCallable");
|
|
8
|
+
// Move to @atlaspack/utils or a dedicated v3 / migration package later
|
|
9
|
+
function toFileSystemV3(fs) {
|
|
10
|
+
return {
|
|
11
|
+
canonicalize: (0, _jsCallable.jsCallable)(path => fs.realpathSync(path)),
|
|
12
|
+
createDirectory: (0, _jsCallable.jsCallable)(path => fs.mkdirp(path)),
|
|
13
|
+
cwd: (0, _jsCallable.jsCallable)(() => fs.cwd()),
|
|
14
|
+
readFile: (0, _jsCallable.jsCallable)((path, encoding) => fs.readFileSync(path, encoding ?? 'utf8')),
|
|
15
|
+
isFile: path => {
|
|
16
|
+
try {
|
|
17
|
+
return fs.statSync(path).isFile();
|
|
18
|
+
} catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
isDir: path => {
|
|
23
|
+
try {
|
|
24
|
+
return fs.statSync(path).isDirectory();
|
|
25
|
+
} catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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, "toFileSystemV3", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _fs.toFileSystemV3;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _fs = require("./fs");
|
|
19
|
+
var _AtlaspackV = require("./AtlaspackV3");
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.jsCallable = jsCallable;
|
|
7
|
+
function jsCallable(fn) {
|
|
8
|
+
return (...args) => {
|
|
9
|
+
try {
|
|
10
|
+
return fn(...args);
|
|
11
|
+
} catch (err) {
|
|
12
|
+
return err;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Resolver = require("./Resolver");
|
|
7
|
+
Object.keys(_Resolver).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Resolver[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Resolver[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AtlaspackWorker = void 0;
|
|
7
|
+
function napi() {
|
|
8
|
+
const data = _interopRequireWildcard(require("@atlaspack/rust"));
|
|
9
|
+
napi = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _worker_threads() {
|
|
15
|
+
const data = require("worker_threads");
|
|
16
|
+
_worker_threads = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
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); }
|
|
22
|
+
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; }
|
|
23
|
+
class AtlaspackWorker {
|
|
24
|
+
#resolvers;
|
|
25
|
+
ping() {
|
|
26
|
+
// console.log('Hi');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.AtlaspackWorker = AtlaspackWorker;
|
|
30
|
+
napi().registerWorker(_worker_threads().workerData.tx_worker, new AtlaspackWorker());
|