Revert "Merge remote-tracking branch 'origin/fix/core-runtime-weak-deps' into release-3.0-test-command"

This reverts commit d5fb29d78c, reversing
changes made to c615639de2.
This commit is contained in:
Gabriel Grubba
2023-03-01 09:56:35 -03:00
parent bdc2ff478a
commit 98a09e6be5
2 changed files with 16 additions and 24 deletions

View File

@@ -1072,10 +1072,7 @@ export class PackageSourceBatch {
// depends on something).
self.importedSymbolToPackageName = {}; // map from symbol to supplying package name
// List of packages (including weak) that need to load before
// this unibuild
self.orderedDeps = new Set();
self.deps = [];
}
async init() {
@@ -1098,26 +1095,17 @@ export class PackageSourceBatch {
skipDebugOnly: true,
skipProdOnly: true,
skipTestOnly: true,
}, (depUnibuild) => {
}, (depUnibuild, { weak, unordered }) => {
let packageName = depUnibuild.pkg.name;
self.orderedDeps.add(packageName);
_.each(depUnibuild.declaredExports, function (symbol) {
// Slightly hacky implementation of test-only exports.
if (! symbol.testOnly || self.unibuild.pkg.isTest) {
self.importedSymbolToPackageName[symbol.name] = packageName;
}
});
});
// At this point we can't easily know all weak dependencies
// that are actually used to pass them to eachUsedUnibuild.
// So instead we loop over the packages again to add them.
self.unibuild.uses.forEach(uses => {
if (uses.weak) {
self.orderedDeps.add(uses.package);
}
self.deps.push({ package: packageName, weak, unordered });
});
self.useMeteorInstall =
@@ -1712,7 +1700,7 @@ export class PackageSourceBatch {
imports: self.importedSymbolToPackageName,
// XXX report an error if there is a package called global-imports
includeSourceMapInstructions: isWeb,
orderedDeps: Array.from(self.orderedDeps)
deps: self.deps
};
const fileHashes = [];

View File

@@ -941,8 +941,12 @@ var getHeader = function (options) {
var isApp = options.name === null;
var chunks = [];
let orderedDeps = options.orderedDeps.map(packageName => {
return JSON.stringify(packageName);
let orderedDeps = [];
options.deps.forEach(dep => {
if (!dep.unordered) {
orderedDeps.push(JSON.stringify(dep.package))
}
});
chunks.push(
@@ -1136,9 +1140,9 @@ export var fullLink = Profile("linker.fullLink", async function (inputFiles, {
// how to use them in a browser.
includeSourceMapInstructions,
// List of packages this bundle directly uses that need to load
// first. Includes weak dependencies.
orderedDeps
// List of packages this bundle directly uses, or is implied by the packages
// it uses
deps
}) {
buildmessage.assertInJob();
@@ -1155,7 +1159,7 @@ export var fullLink = Profile("linker.fullLink", async function (inputFiles, {
// we can be sure the runtime will be available
// The main situations it is not available is the core-runtime
// package itself, or any build plugins with no dependencies
let hasRuntime = orderedDeps.length > 0;
let hasRuntime = deps.some(entry => entry.unordered !== true);
_.each(inputFiles, file => module.addFile(file));
@@ -1190,7 +1194,7 @@ export var fullLink = Profile("linker.fullLink", async function (inputFiles, {
imports,
packageVariables: [],
hasRuntime,
orderedDeps
deps
});
let footer = getFooter({
name: null,
@@ -1251,7 +1255,7 @@ export var fullLink = Profile("linker.fullLink", async function (inputFiles, {
imports,
packageVariables: _.union(assignedVariables, declaredExports),
hasRuntime,
orderedDeps
deps
});
var footer = getFooter({