npm package diff
Package: @forge/bundler
Versions: 4.19.0-next.13 - 4.19.0-next.14
File: package/out/config/common.js
Index: package/out/config/common.js
===================================================================
--- package/out/config/common.js
+++ package/out/config/common.js
@@ -1,27 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCommonWebpackConfig = exports.geti18nRule = exports.getDevToolConfig = exports.resolveStubPath = exports.resolveModulePath = exports.getEntryPoints = void 0;
const tslib_1 = require("tslib");
-const path_1 = require("path");
+const path_1 = tslib_1.__importDefault(require("path"));
const webpack_1 = tslib_1.__importDefault(require("webpack"));
-const text_1 = require("../text");
const cli_shared_1 = require("@forge/cli-shared");
const i18n_1 = require("@forge/i18n");
+const text_1 = require("../text");
const tsconfig_interactor_1 = require("../tsconfig-interactor");
function getEntryPoints(handlers) {
- const entryPointMap = new Map();
- for (const { module, func } of handlers) {
- if (!entryPointMap.has(module)) {
- entryPointMap.set(module, []);
- }
- entryPointMap.get(module).push(func);
- }
- const currentDirectory = process.cwd();
- return Array.from(entryPointMap.entries()).map(([module, functions]) => ({
+ const modules = new Set(handlers.map(({ module }) => module));
+ return Array.from(modules).map((module) => ({
name: module,
- path: (0, path_1.join)(currentDirectory, 'src', module),
- functions
+ path: path_1.default.resolve('src', module)
}));
}
exports.getEntryPoints = getEntryPoints;
const resolveModulePath = (moduleName) => {
@@ -40,12 +32,12 @@
};
exports.getDevToolConfig = getDevToolConfig;
const geti18nRule = (i18nConfig) => {
const i18nResources = i18nConfig.resources || [];
- const i18nResourcesMap = new Map(i18nResources.map(({ key, path }) => [(0, path_1.resolve)(path), key]));
+ const i18nResourcesMap = new Map(i18nResources.map(({ key, path: resource }) => [path_1.default.resolve(resource), key]));
const getFilename = ({ module: { resource: i18nResourcePath } }) => {
const i18nResourceKey = i18nResourcesMap.get(i18nResourcePath);
- return (0, path_1.join)(i18n_1.I18N_BUNDLE_FOLDER_NAME, `${i18nResourceKey}.json`);
+ return path_1.default.join(i18n_1.I18N_BUNDLE_FOLDER_NAME, `${i18nResourceKey}.json`);
};
return {
test: /\.json$/i,
include: Array.from(i18nResourcesMap.keys()),
@@ -61,9 +53,9 @@
throw new Error(text_1.Text.noExecutableFile);
}
const resolvedEntryPoints = {};
for (const entrypoint of entrypoints) {
- resolvedEntryPoints[entrypoint.name] = (0, path_1.resolve)(entrypoint.path);
+ resolvedEntryPoints[entrypoint.name] = path_1.default.resolve(entrypoint.path);
}
return {
entry: resolvedEntryPoints,
mode: 'production',
@@ -74,9 +66,9 @@
output: {
libraryTarget: 'commonjs',
globalObject: 'this',
filename: '[name].js',
- path: '/'
+ path: config.outputDir
},
node: {
__dirname: true
},