Skip to content

Commit

Permalink
Merge pull request #9311 from meteor/package.json-browser-object-rela…
Browse files Browse the repository at this point in the history
…tive-style

Support object-valued "browser" field in package.json.
  • Loading branch information
benjamn committed Nov 6, 2017
2 parents 6f716ee + 1cbcfb5 commit d357116
Show file tree
Hide file tree
Showing 14 changed files with 1,258 additions and 107 deletions.
11 changes: 7 additions & 4 deletions tools/isobuild/compiler-plugin.js
Expand Up @@ -8,6 +8,7 @@ var linker = require('./linker.js');
var util = require('util');
var _ = require('underscore');
var Profile = require('../tool-env/profile.js').Profile;
import assert from "assert";
import {sha1, readAndWatchFileWithHash} from '../fs/watch.js';
import LRU from 'lru-cache';
import {sourceMapLength} from '../utils/utils.js';
Expand Down Expand Up @@ -1124,11 +1125,12 @@ export class PackageSourceBatch {
const appFilesWithoutNodeModules = [];

outputFiles.forEach(file => {
const parts = file.installPath.split("/");
const parts = file.absModuleId.split("/");
assert.strictEqual(parts[0], "");
const nodeModulesIndex = parts.indexOf("node_modules");

if (nodeModulesIndex === -1 || (nodeModulesIndex === 0 &&
parts[1] === "meteor")) {
if (nodeModulesIndex === -1 || (nodeModulesIndex === 1 &&
parts[2] === "meteor")) {
appFilesWithoutNodeModules.push(file);
} else {
// This file is going to be installed in a node_modules
Expand Down Expand Up @@ -1308,10 +1310,11 @@ export class PackageSourceBatch {
files: jsResources.map((inputFile) => {
fileHashes.push(inputFile.hash);
return {
installPath: inputFile.installPath,
absModuleId: inputFile.absModuleId,
sourceMap: !! inputFile.sourceMap,
mainModule: inputFile.mainModule,
imported: inputFile.imported,
alias: inputFile.alias,
lazy: inputFile.lazy,
bare: inputFile.bare,
};
Expand Down

0 comments on commit d357116

Please sign in to comment.