Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/max-size-reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Jul 10, 2018
2 parents 9362a65 + f95d0f0 commit b32a4f5
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 59 deletions.
1 change: 0 additions & 1 deletion declarations.d.ts
Expand Up @@ -7,7 +7,6 @@ declare namespace NodeJS {
}
}


declare module "neo-async" {
export interface Dictionary<T> {
[key: string]: T;
Expand Down
21 changes: 20 additions & 1 deletion lib/ContextModule.js
Expand Up @@ -12,11 +12,28 @@ const contextify = require("./util/identifier").contextify;

/** @typedef {import("./dependencies/ContextElementDependency")} ContextElementDependency */

/**
* @callback ResolveDependenciesCallback
* @param {Error=} err
* @param {ContextElementDependency[]} dependencies
*/

/**
* @callback ResolveDependencies
* @param {TODO} fs
* @param {TODO} options
* @param {ResolveDependenciesCallback} callback
*/

class ContextModule extends Module {
// type ContextMode = "sync" | "eager" | "weak" | "async-weak" | "lazy" | "lazy-once"
// type ContextOptions = { resource: string, recursive: boolean, regExp: RegExp, addon?: string, mode?: ContextMode, chunkName?: string, include?: RegExp, exclude?: RegExp, groupOptions?: Object }
// resolveDependencies: (fs: FS, options: ContextOptions, (err: Error?, dependencies: Dependency[]) => void) => void
// options: ContextOptions
/**
* @param {ResolveDependencies} resolveDependencies function to get dependencies in this context
* @param {TODO} options options object
*/
constructor(resolveDependencies, options) {
let resource;
let resourceQuery;
Expand Down Expand Up @@ -194,7 +211,9 @@ class ContextModule extends Module {

// enhance dependencies with meta info
for (const dep of dependencies) {
dep.loc = dep.userRequest;
dep.loc = {
name: dep.userRequest
};
dep.request = this.options.addon + dep.request;
}

Expand Down
8 changes: 7 additions & 1 deletion lib/DelegatedModuleFactoryPlugin.js
Expand Up @@ -15,7 +15,13 @@ class DelegatedModuleFactoryPlugin {
constructor(options) {
this.options = options;
options.type = options.type || "require";
options.extensions = options.extensions || ["", ".js"];
options.extensions = options.extensions || [
"",
".wasm",
".mjs",
".js",
".json"
];
}

apply(normalModuleFactory) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Dependency.js
Expand Up @@ -30,7 +30,7 @@ const DependencyReference = require("./dependencies/DependencyReference");

/** @typedef {Object} SynteticDependencyLocation
* @property {string} name
* @property {number} index
* @property {number=} index
*/

/** @typedef {SynteticDependencyLocation|RealDependencyLocation} DependencyLocation */
Expand Down
14 changes: 10 additions & 4 deletions lib/Stats.js
Expand Up @@ -15,6 +15,12 @@ const optionsOrFallback = (...args) => {
return optionValues.find(optionValue => typeof optionValue !== "undefined");
};

const compareId = (a, b) => {
if (a < b) return -1;
if (a > b) return 1;
return 0;
};

class Stats {
constructor(compilation) {
this.compilation = compilation;
Expand Down Expand Up @@ -543,7 +549,7 @@ class Stats {
}
return obj;
})
.sort((a, b) => a.moduleId - b.moduleId);
.sort(compareId);
}
if (showUsedExports) {
if (module.used === true) {
Expand Down Expand Up @@ -614,9 +620,9 @@ class Stats {
names: chunk.name ? [chunk.name] : [],
files: chunk.files.slice(),
hash: chunk.renderedHash,
siblings: Array.from(siblings).sort(),
parents: Array.from(parents).sort(),
children: Array.from(children).sort(),
siblings: Array.from(siblings).sort(compareId),
parents: Array.from(parents).sort(compareId),
children: Array.from(children).sort(compareId),
childrenByOrder: childIdByOrder
};
if (showChunkModules) {
Expand Down

0 comments on commit b32a4f5

Please sign in to comment.