piral-cli-webpack5 0.15.0-alpha.3549 → 0.15.0-alpha.3592
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extend-config.js +21 -5
- package/lib/enhancers/pilet-webpack-config-enhancer/helpers.d.ts +0 -1
- package/lib/enhancers/pilet-webpack-config-enhancer/helpers.js +2 -20
- package/lib/enhancers/pilet-webpack-config-enhancer/helpers.js.map +1 -1
- package/lib/enhancers/pilet-webpack-config-enhancer/index.js +1 -1
- package/lib/enhancers/pilet-webpack-config-enhancer/index.js.map +1 -1
- package/package.json +3 -3
- package/src/enhancers/pilet-webpack-config-enhancer/helpers.ts +1 -18
- package/src/enhancers/pilet-webpack-config-enhancer/index.ts +1 -2
package/extend-config.js
CHANGED
|
@@ -78,13 +78,29 @@ function changeLoaderOptions(config, name, options) {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Use this function to create a function to return from your webpack
|
|
83
|
+
* configuration module. The created function can be used to conveniently
|
|
84
|
+
* override and etend the original configuration.
|
|
85
|
+
* @typedef OverrideOptions
|
|
86
|
+
* @property {any=} tsLoaderOptions The new options for the ts-loader
|
|
87
|
+
* @property {any=} babelLoaderOptions The new options for the babel-loader
|
|
88
|
+
* @property {any=} cssLoaderOptions The new options for the css-loader
|
|
89
|
+
* @property {any=} sassLoaderOptions The new options for the sass-loader
|
|
90
|
+
* @property {boolean=} checkTypes Determines the value of the transpileOnly option in ts-loader
|
|
91
|
+
* @property {boolean=} noPresets Determines if presets should be set to undefined in babel-loader
|
|
92
|
+
* @property {Array<{ name: string, rule: any }>=} updateRules Overrides the rules determined by its loader name with the provided rule
|
|
93
|
+
* @property {Array<string>=} removeRules Removes the rules determined by its loader name
|
|
94
|
+
* @property {Array<any>=} rules Inserts the given rules in the beginning
|
|
95
|
+
* @property {Array<{ type: any, plugin: any }>=} updatePlugins Overrides the plugins determined by its class reference (instance) with the provided plugin
|
|
96
|
+
* @property {Array<any>=} removePlugins Removes the plugins determined by its class reference (instance)
|
|
97
|
+
* @property {Array<any>=} plugins Inserts the given plugins in the end
|
|
98
|
+
* @param {OverrideOptions} override
|
|
99
|
+
* @returns {(config: webpack.Configuration) => webpack.Configuration}
|
|
100
|
+
*/
|
|
81
101
|
module.exports = function (override) {
|
|
82
102
|
return (config) => {
|
|
83
103
|
if (override && typeof override === 'object') {
|
|
84
|
-
if ('fileLoaderOptions' in override) {
|
|
85
|
-
changeLoaderOptions(config, 'file-loader', override.fileLoaderOptions);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
104
|
if ('tsLoaderOptions' in override) {
|
|
89
105
|
changeLoaderOptions(config, 'ts-loader', override.tsLoaderOptions);
|
|
90
106
|
}
|
|
@@ -143,7 +159,7 @@ module.exports = function (override) {
|
|
|
143
159
|
|
|
144
160
|
if ('updatePlugins' in override && Array.isArray(override.updatePlugins)) {
|
|
145
161
|
override.updatePlugins.forEach((def) => {
|
|
146
|
-
if (def.type && def.
|
|
162
|
+
if (def.type && def.plugin) {
|
|
147
163
|
changePlugin(config, def.type, def.plugin);
|
|
148
164
|
}
|
|
149
165
|
});
|
|
@@ -3,7 +3,6 @@ import { Configuration } from 'webpack';
|
|
|
3
3
|
export declare function getVariables(name: string, version: string, env: string): Record<string, string>;
|
|
4
4
|
export declare function setEnvironment(variables: Record<string, string>): void;
|
|
5
5
|
export declare function getDefineVariables(variables: Record<string, string>): {};
|
|
6
|
-
export declare function getExternals(piral: string): any[];
|
|
7
6
|
export declare function getDependencies(importmap: Array<SharedDependency>, compilerOptions: Configuration): {};
|
|
8
7
|
export declare function withSetPath(compilerOptions: Configuration): void;
|
|
9
8
|
export declare function withExternals(compilerOptions: Configuration, externals: Array<string>): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withExternals = exports.withSetPath = exports.getDependencies = exports.
|
|
3
|
+
exports.withExternals = exports.withSetPath = exports.getDependencies = exports.getDefineVariables = exports.setEnvironment = exports.getVariables = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
function getVariables(name, version, env) {
|
|
6
6
|
return {
|
|
@@ -23,31 +23,13 @@ function getDefineVariables(variables) {
|
|
|
23
23
|
}, {});
|
|
24
24
|
}
|
|
25
25
|
exports.getDefineVariables = getDefineVariables;
|
|
26
|
-
function getExternals(piral) {
|
|
27
|
-
var _a, _b;
|
|
28
|
-
const shellPkg = require(`${piral}/package.json`);
|
|
29
|
-
const piralExternals = (_b = (_a = shellPkg.pilets) === null || _a === void 0 ? void 0 : _a.externals) !== null && _b !== void 0 ? _b : [];
|
|
30
|
-
return [
|
|
31
|
-
...piralExternals,
|
|
32
|
-
'@dbeining/react-atom',
|
|
33
|
-
'@libre/atom',
|
|
34
|
-
'history',
|
|
35
|
-
'react',
|
|
36
|
-
'react-dom',
|
|
37
|
-
'react-router',
|
|
38
|
-
'react-router-dom',
|
|
39
|
-
'tslib',
|
|
40
|
-
'path-to-regexp',
|
|
41
|
-
];
|
|
42
|
-
}
|
|
43
|
-
exports.getExternals = getExternals;
|
|
44
26
|
function getDependencies(importmap, compilerOptions) {
|
|
45
27
|
const dependencies = {};
|
|
46
28
|
const { entry, externals } = compilerOptions;
|
|
47
29
|
if (typeof entry === 'object' && entry && Array.isArray(externals) && typeof externals[0] === 'object') {
|
|
48
30
|
for (const dep of importmap) {
|
|
49
31
|
dependencies[dep.id] = dep.ref;
|
|
50
|
-
externals[0][dep.name] = dep.
|
|
32
|
+
externals[0][dep.name] = dep.requireId;
|
|
51
33
|
if (dep.type === 'local') {
|
|
52
34
|
entry[dep.ref.replace(/\.js$/, '')] = dep.entry;
|
|
53
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/enhancers/pilet-webpack-config-enhancer/helpers.ts"],"names":[],"mappings":";;;AAAA,+BA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MAAM,CAAC,QAAQ,CAAC,EAAE;QACpD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE;YAChE,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;gBAC1B,cAAc,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;aACrC;YACD,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IAEH,eAAe,CAAC,SAAS,GAAG,CAAC,cAAc,EAAE,GAAG,YAAY,CAAC,CAAC;AAChE,CAAC;AApBD,sCAoBC"}
|
|
@@ -71,7 +71,7 @@ function piletV2WebpackConfigEnhancer(options, compiler) {
|
|
|
71
71
|
return compiler;
|
|
72
72
|
}
|
|
73
73
|
const piletWebpackConfigEnhancer = (details) => (compiler) => {
|
|
74
|
-
const {
|
|
74
|
+
const { externals = [], schema, importmap } = details;
|
|
75
75
|
const environment = process.env.NODE_ENV || 'development';
|
|
76
76
|
const options = {
|
|
77
77
|
entry: details.entry,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/enhancers/pilet-webpack-config-enhancer/index.ts"],"names":[],"mappings":";;;AAAA,4GAA4G;AAE5G,qCAAoE;AACpE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/enhancers/pilet-webpack-config-enhancer/index.ts"],"names":[],"mappings":";;;AAAA,4GAA4G;AAE5G,qCAAoE;AACpE,uCAOmB;AAmDnB,SAAS,4BAA4B,CAAC,OAA8B,EAAE,QAAuB;IAC3F,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAEzC,IAAA,qBAAW,EAAC,QAAQ,CAAC,CAAC;IACtB,IAAA,wBAAc,EAAC,SAAS,CAAC,CAAC;IAC1B,IAAA,uBAAa,EAAC,QAAQ,EAAE,SAAS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E,QAAQ,CAAC,CAAC;QACzD,KAAK,IAAI;YACP,OAAO,4BAA4B,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACzD,KAAK,IAAI;YACP,OAAO,4BAA4B,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACzD,KAAK,MAAM,CAAC;QACZ;YACE,OAAO,4BAA4B,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;KAC1D;AACH,CAAC,CAAC;AA1BW,QAAA,0BAA0B,8BA0BrC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-cli-webpack5",
|
|
3
|
-
"version": "0.15.0-alpha.
|
|
3
|
+
"version": "0.15.0-alpha.3592",
|
|
4
4
|
"description": "Provides debug and build capabilities for pilets and Piral instances using Webpack v5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral-cli",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@types/node": "^13.9.0",
|
|
49
49
|
"@types/terser-webpack-plugin": "^5.0.0",
|
|
50
50
|
"@types/yargs": "^15.0.4",
|
|
51
|
-
"piral-cli": "0.15.0-alpha.
|
|
51
|
+
"piral-cli": "0.15.0-alpha.3592",
|
|
52
52
|
"strip-ansi": "^3.0.0",
|
|
53
53
|
"typescript": "^4.0.2"
|
|
54
54
|
},
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"webpack": "^5.1.3",
|
|
78
78
|
"webpack-inject-plugin": "^1.5.5"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "5537ccd39d275afdc53845ab8cb4868a8dbc8903"
|
|
81
81
|
}
|
|
@@ -23,23 +23,6 @@ export function getDefineVariables(variables: Record<string, string>) {
|
|
|
23
23
|
}, {});
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export function getExternals(piral: string) {
|
|
27
|
-
const shellPkg = require(`${piral}/package.json`);
|
|
28
|
-
const piralExternals = shellPkg.pilets?.externals ?? [];
|
|
29
|
-
return [
|
|
30
|
-
...piralExternals,
|
|
31
|
-
'@dbeining/react-atom',
|
|
32
|
-
'@libre/atom',
|
|
33
|
-
'history',
|
|
34
|
-
'react',
|
|
35
|
-
'react-dom',
|
|
36
|
-
'react-router',
|
|
37
|
-
'react-router-dom',
|
|
38
|
-
'tslib',
|
|
39
|
-
'path-to-regexp',
|
|
40
|
-
];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
26
|
export function getDependencies(importmap: Array<SharedDependency>, compilerOptions: Configuration) {
|
|
44
27
|
const dependencies = {};
|
|
45
28
|
const { entry, externals } = compilerOptions;
|
|
@@ -47,7 +30,7 @@ export function getDependencies(importmap: Array<SharedDependency>, compilerOpti
|
|
|
47
30
|
if (typeof entry === 'object' && entry && Array.isArray(externals) && typeof externals[0] === 'object') {
|
|
48
31
|
for (const dep of importmap) {
|
|
49
32
|
dependencies[dep.id] = dep.ref;
|
|
50
|
-
externals[0][dep.name] = dep.
|
|
33
|
+
externals[0][dep.name] = dep.requireId;
|
|
51
34
|
|
|
52
35
|
if (dep.type === 'local') {
|
|
53
36
|
entry[dep.ref.replace(/\.js$/, '')] = dep.entry;
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
withSetPath,
|
|
9
9
|
withExternals,
|
|
10
10
|
getDependencies,
|
|
11
|
-
getExternals,
|
|
12
11
|
} from './helpers';
|
|
13
12
|
|
|
14
13
|
export interface PiletWebpackConfigEnhancerOptions {
|
|
@@ -155,7 +154,7 @@ function piletV2WebpackConfigEnhancer(options: SchemaEnhancerOptions, compiler:
|
|
|
155
154
|
}
|
|
156
155
|
|
|
157
156
|
export const piletWebpackConfigEnhancer = (details: PiletWebpackConfigEnhancerOptions) => (compiler: Configuration) => {
|
|
158
|
-
const {
|
|
157
|
+
const { externals = [], schema, importmap } = details;
|
|
159
158
|
const environment = process.env.NODE_ENV || 'development';
|
|
160
159
|
const options: SchemaEnhancerOptions = {
|
|
161
160
|
entry: details.entry,
|