Skip to content

Commit f808468

Browse files
author
Ben Newman
committed
Commit some accidentally unstaged changes.
1 parent a92aaee commit f808468

2 files changed

Lines changed: 13 additions & 24 deletions

File tree

tools/isobuild/bundler.js

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,8 @@ export class NodeModulesDirectory {
224224
writePackageJSON = false,
225225
}) {
226226
// Name of the package this node_modules directory belongs to, or null
227-
// if it belongs to an application. Sometimes undefined when we don't
228-
// know what package it belongs to, e.g. when reading node_modules
229-
// from a program.json file.
230-
assert.ok(typeof packageName === "string" ||
231-
typeof packageName === "undefined" ||
232-
packageName === null);
227+
// if it belongs to an application.
228+
assert.ok(typeof packageName === "string" || packageName === null);
233229
this.packageName = packageName;
234230

235231
// The absolute path of the root directory of the app or package that
@@ -270,11 +266,7 @@ export class NodeModulesDirectory {
270266
kind === "isopack",
271267
kind);
272268

273-
// Though we allow this.packageName to be undefined in the
274-
// constructor, we must know the package that contains this
275-
// node_modules directory to call getPreferredBundlePath.
276269
const name = this.packageName;
277-
assert.ok(typeof name === "string" || name === null);
278270

279271
let relPath = files.pathRelative(this.sourceRoot, this.sourcePath);
280272
rejectBadPath(relPath);
@@ -288,7 +280,8 @@ export class NodeModulesDirectory {
288280
// Normalize .npm/package/node_modules/... paths so that they get
289281
// copied into the bundle as if they were in the top-level local
290282
// node_modules directory of the package.
291-
relPath = relParts.slice(2).join(files.pathSep);
283+
relParts.shift();
284+
relParts.shift();
292285
} else if (relParts[0] === "npm") {
293286
const rootParts = this.sourceRoot.split(files.pathSep);
294287
if (rootParts.indexOf(".meteor") >= 0) {
@@ -301,13 +294,14 @@ export class NodeModulesDirectory {
301294
}
302295

303296
if (kind === "bundle") {
304-
relPath = files.pathJoin(
297+
relParts.unshift(
305298
"node_modules",
306299
"meteor",
307-
colonConverter.convert(name),
308-
...relParts
300+
colonConverter.convert(name)
309301
);
310302
}
303+
304+
relPath = files.pathJoin(...relParts);
311305
}
312306

313307
// It's important not to put node_modules at the top level, so that it
@@ -1795,12 +1789,6 @@ class JsImage {
17951789
_.extend(
17961790
ret.nodeModulesDirectories,
17971791
nodeModulesDirectories =
1798-
// If item.node_modules is just a string, rather than an
1799-
// object with information about more than one node_modules
1800-
// directory, then we have no good way of knowing the
1801-
// packageName, but that's fine because we don't need to copy
1802-
// this node_modules directory into the bundle, so we
1803-
// shouldn't need to call getPreferredBundlePath.
18041792
NodeModulesDirectory.readDirsFromJSON(item.node_modules, {
18051793
packageName: files.pathBasename(dir),
18061794
sourceRoot: dir

tools/static-assets/server/boot.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,12 @@ Fiber(function () {
247247
}
248248
};
249249

250-
var baseName = fileInfo.path.split(files.pathSep).pop();
251-
var isModulesRuntime = baseName === "modules-runtime.js";
252-
var wrapParts = ["(function(Npm, Assets"];
250+
var isModulesRuntime =
251+
fileInfo.path === "packages/modules-runtime.js";
252+
253+
var wrapParts = ["(function(Npm,Assets"];
253254
if (isModulesRuntime) {
254-
wrapParts.push(", npmRequire");
255+
wrapParts.push(",npmRequire");
255256
}
256257
// \n is necessary in case final line is a //-comment
257258
wrapParts.push("){", code, "\n})");

0 commit comments

Comments
 (0)