piral-cli-webpack5 1.0.0-pre.1960 → 1.0.1-beta.5640
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/LICENSE +1 -1
- package/README.md +31 -10
- package/extend-config.js +125 -18
- package/lib/actions.d.ts +2 -2
- package/lib/actions.js +33 -39
- package/lib/actions.js.map +1 -1
- package/lib/{configs → enhancers/hmr-webpack-config-enhancer}/HotModuleServerPlugin.js +1 -1
- package/lib/enhancers/hmr-webpack-config-enhancer/HotModuleServerPlugin.js.map +1 -0
- package/lib/enhancers/hmr-webpack-config-enhancer/index.d.ts +5 -0
- package/lib/enhancers/hmr-webpack-config-enhancer/index.js +30 -0
- package/lib/enhancers/hmr-webpack-config-enhancer/index.js.map +1 -0
- package/lib/enhancers/html5-entry-webpack-config-enhancer/helpers.d.ts +2 -2
- package/lib/enhancers/html5-entry-webpack-config-enhancer/helpers.js +1 -1
- package/lib/enhancers/html5-entry-webpack-config-enhancer/helpers.js.map +1 -1
- package/lib/enhancers/html5-entry-webpack-config-enhancer/index.d.ts +2 -1
- package/lib/enhancers/html5-entry-webpack-config-enhancer/index.js +17 -6
- package/lib/enhancers/html5-entry-webpack-config-enhancer/index.js.map +1 -1
- package/lib/enhancers/pilet-webpack-config-enhancer/helpers.d.ts +5 -0
- package/lib/enhancers/pilet-webpack-config-enhancer/helpers.js +53 -1
- package/lib/enhancers/pilet-webpack-config-enhancer/helpers.js.map +1 -1
- package/lib/enhancers/pilet-webpack-config-enhancer/index.d.ts +18 -4
- package/lib/enhancers/pilet-webpack-config-enhancer/index.js +117 -49
- package/lib/enhancers/pilet-webpack-config-enhancer/index.js.map +1 -1
- package/lib/enhancers/piral-instance-webpack-config-enhancer/helpers.js +2 -0
- package/lib/enhancers/piral-instance-webpack-config-enhancer/helpers.js.map +1 -1
- package/lib/enhancers/piral-instance-webpack-config-enhancer/index.d.ts +2 -3
- package/lib/enhancers/piral-instance-webpack-config-enhancer/index.js +6 -7
- package/lib/enhancers/piral-instance-webpack-config-enhancer/index.js.map +1 -1
- package/lib/helpers.d.ts +2 -1
- package/lib/helpers.js +10 -4
- package/lib/helpers.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/plugins/SheetLoader.d.ts +1 -0
- package/lib/plugins/SheetLoader.js +19 -0
- package/lib/plugins/SheetLoader.js.map +1 -0
- package/lib/plugins/SheetPlugin.d.ts +7 -0
- package/lib/plugins/SheetPlugin.js +31 -0
- package/lib/plugins/SheetPlugin.js.map +1 -0
- package/lib/plugins/StylesLoader.d.ts +1 -0
- package/lib/plugins/StylesLoader.js +14 -0
- package/lib/plugins/StylesLoader.js.map +1 -0
- package/lib/plugins/StylesPlugin.d.ts +6 -0
- package/lib/plugins/StylesPlugin.js +34 -0
- package/lib/plugins/StylesPlugin.js.map +1 -0
- package/lib/webpack/bundler-run.d.ts +2 -21
- package/lib/webpack/bundler-run.js +54 -46
- package/lib/webpack/bundler-run.js.map +1 -1
- package/lib/webpack/common.d.ts +8 -0
- package/lib/webpack/common.js +104 -0
- package/lib/webpack/common.js.map +1 -0
- package/lib/webpack/pilet.d.ts +19 -0
- package/lib/webpack/pilet.js +97 -0
- package/lib/webpack/pilet.js.map +1 -0
- package/lib/webpack/piral.d.ts +16 -0
- package/lib/webpack/piral.js +90 -0
- package/lib/webpack/piral.js.map +1 -0
- package/package.json +28 -29
- package/src/actions.ts +33 -20
- package/src/{configs → enhancers/hmr-webpack-config-enhancer}/HotModuleServerPlugin.ts +1 -1
- package/src/enhancers/hmr-webpack-config-enhancer/index.ts +34 -0
- package/src/enhancers/html5-entry-webpack-config-enhancer/helpers.ts +7 -7
- package/src/enhancers/html5-entry-webpack-config-enhancer/index.ts +31 -19
- package/src/enhancers/pilet-webpack-config-enhancer/helpers.ts +62 -0
- package/src/enhancers/pilet-webpack-config-enhancer/index.ts +187 -59
- package/src/enhancers/piral-instance-webpack-config-enhancer/helpers.ts +2 -0
- package/src/enhancers/piral-instance-webpack-config-enhancer/index.ts +14 -18
- package/src/helpers.ts +15 -5
- package/src/index.ts +1 -1
- package/src/plugins/SheetLoader.ts +16 -0
- package/src/plugins/SheetPlugin.ts +34 -0
- package/src/plugins/StylesLoader.ts +11 -0
- package/src/plugins/StylesPlugin.ts +35 -0
- package/src/webpack/bundler-run.ts +60 -56
- package/src/webpack/common.ts +111 -0
- package/src/webpack/pilet.ts +121 -0
- package/src/webpack/piral.ts +110 -0
- package/src/webpack-hot-middleware/LICENSE +20 -0
- package/src/webpack-hot-middleware/client-overlay.js +99 -0
- package/src/webpack-hot-middleware/client.js +306 -0
- package/src/webpack-hot-middleware/helpers.js +9 -0
- package/src/webpack-hot-middleware/middleware.js +175 -0
- package/src/webpack-hot-middleware/process-update.js +157 -0
- package/lib/configs/HotModuleServerPlugin.js.map +0 -1
- package/lib/configs/SheetLoader.d.ts +0 -1
- package/lib/configs/SheetLoader.js +0 -27
- package/lib/configs/SheetLoader.js.map +0 -1
- package/lib/configs/common.d.ts +0 -6
- package/lib/configs/common.js +0 -115
- package/lib/configs/common.js.map +0 -1
- package/lib/configs/index.d.ts +0 -2
- package/lib/configs/index.js +0 -15
- package/lib/configs/index.js.map +0 -1
- package/lib/configs/pilet.d.ts +0 -3
- package/lib/configs/pilet.js +0 -72
- package/lib/configs/pilet.js.map +0 -1
- package/lib/configs/piral.d.ts +0 -2
- package/lib/configs/piral.js +0 -65
- package/lib/configs/piral.js.map +0 -1
- package/lib/webpack/bundler-calls.d.ts +0 -3
- package/lib/webpack/bundler-calls.js +0 -93
- package/lib/webpack/bundler-calls.js.map +0 -1
- package/lib/webpack/index.d.ts +0 -1
- package/lib/webpack/index.js +0 -14
- package/lib/webpack/index.js.map +0 -1
- package/lib/webpack/run-build-pilet.d.ts +0 -1
- package/lib/webpack/run-build-pilet.js +0 -53
- package/lib/webpack/run-build-pilet.js.map +0 -1
- package/lib/webpack/run-build-piral.d.ts +0 -1
- package/lib/webpack/run-build-piral.js +0 -56
- package/lib/webpack/run-build-piral.js.map +0 -1
- package/lib/webpack/run-debug-mono-piral.d.ts +0 -1
- package/lib/webpack/run-debug-mono-piral.js +0 -61
- package/lib/webpack/run-debug-mono-piral.js.map +0 -1
- package/lib/webpack/run-debug-pilet.d.ts +0 -1
- package/lib/webpack/run-debug-pilet.js +0 -77
- package/lib/webpack/run-debug-pilet.js.map +0 -1
- package/lib/webpack/run-debug-piral.d.ts +0 -1
- package/lib/webpack/run-debug-piral.js +0 -76
- package/lib/webpack/run-debug-piral.js.map +0 -1
- package/src/configs/SheetLoader.ts +0 -12
- package/src/configs/common.ts +0 -118
- package/src/configs/index.ts +0 -2
- package/src/configs/pilet.ts +0 -82
- package/src/configs/piral.ts +0 -73
- package/src/webpack/bundler-calls.ts +0 -107
- package/src/webpack/index.ts +0 -1
- package/src/webpack/run-build-pilet.ts +0 -82
- package/src/webpack/run-build-piral.ts +0 -83
- package/src/webpack/run-debug-mono-piral.ts +0 -76
- package/src/webpack/run-debug-pilet.ts +0 -94
- package/src/webpack/run-debug-piral.ts +0 -95
- /package/lib/{configs → enhancers/hmr-webpack-config-enhancer}/HotModuleServerPlugin.d.ts +0 -0
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type { LogLevels } from 'piral-cli';
|
|
2
|
-
import { setStandardEnvs } from 'piral-cli/utils';
|
|
3
|
-
import { resolve } from 'path';
|
|
4
|
-
import { runWebpack } from './bundler-run';
|
|
5
|
-
import { getPiralConfig } from '../configs';
|
|
6
|
-
import { extendConfig } from '../helpers';
|
|
7
|
-
import { defaultWebpackConfig } from '../constants';
|
|
8
|
-
|
|
9
|
-
async function run(
|
|
10
|
-
root: string,
|
|
11
|
-
piral: string,
|
|
12
|
-
emulator: boolean,
|
|
13
|
-
sourceMaps: boolean,
|
|
14
|
-
contentHash: boolean,
|
|
15
|
-
minify: boolean,
|
|
16
|
-
externals: Array<string>,
|
|
17
|
-
publicUrl: string,
|
|
18
|
-
outDir: string,
|
|
19
|
-
entryFiles: string,
|
|
20
|
-
logLevel: LogLevels,
|
|
21
|
-
) {
|
|
22
|
-
setStandardEnvs({
|
|
23
|
-
production: !emulator,
|
|
24
|
-
root,
|
|
25
|
-
debugPiral: emulator,
|
|
26
|
-
debugPilet: emulator,
|
|
27
|
-
piral,
|
|
28
|
-
dependencies: externals,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
const otherConfigPath = resolve(root, defaultWebpackConfig);
|
|
32
|
-
const baseConfig = await getPiralConfig(
|
|
33
|
-
root,
|
|
34
|
-
entryFiles,
|
|
35
|
-
outDir,
|
|
36
|
-
externals,
|
|
37
|
-
emulator,
|
|
38
|
-
sourceMaps,
|
|
39
|
-
contentHash,
|
|
40
|
-
minify,
|
|
41
|
-
publicUrl,
|
|
42
|
-
);
|
|
43
|
-
const wpConfig = extendConfig(baseConfig, otherConfigPath, {
|
|
44
|
-
watch: false,
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const bundler = runWebpack(wpConfig, logLevel);
|
|
48
|
-
return bundler.bundle();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
process.on('message', async (msg) => {
|
|
52
|
-
switch (msg.type) {
|
|
53
|
-
case 'start':
|
|
54
|
-
const result = await run(
|
|
55
|
-
process.cwd(),
|
|
56
|
-
msg.piral,
|
|
57
|
-
msg.emulator,
|
|
58
|
-
msg.sourceMaps,
|
|
59
|
-
msg.contentHash,
|
|
60
|
-
msg.minify,
|
|
61
|
-
msg.externals,
|
|
62
|
-
msg.publicUrl,
|
|
63
|
-
msg.outDir,
|
|
64
|
-
msg.entryFiles,
|
|
65
|
-
msg.logLevel,
|
|
66
|
-
).catch((error) => {
|
|
67
|
-
process.send({
|
|
68
|
-
type: 'fail',
|
|
69
|
-
error: error?.message,
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
if (result) {
|
|
74
|
-
process.send({
|
|
75
|
-
type: 'done',
|
|
76
|
-
outDir: result.outDir,
|
|
77
|
-
outFile: result.outFile,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type { LogLevels } from 'piral-cli';
|
|
2
|
-
import { setStandardEnvs, progress, getFreePort, logReset } from 'piral-cli/utils';
|
|
3
|
-
import { resolve } from 'path';
|
|
4
|
-
import { runWebpack } from './bundler-run';
|
|
5
|
-
import { extendConfig } from '../helpers';
|
|
6
|
-
import { getPiralConfig } from '../configs';
|
|
7
|
-
import { defaultWebpackConfig } from '../constants';
|
|
8
|
-
|
|
9
|
-
async function run(
|
|
10
|
-
root: string,
|
|
11
|
-
piral: string,
|
|
12
|
-
hmr: boolean,
|
|
13
|
-
externals: Array<string>,
|
|
14
|
-
entryFiles: string,
|
|
15
|
-
logLevel: LogLevels,
|
|
16
|
-
) {
|
|
17
|
-
progress(`Preparing supplied Piral instance ...`);
|
|
18
|
-
|
|
19
|
-
const outDir = resolve(root, 'dist', 'app');
|
|
20
|
-
|
|
21
|
-
setStandardEnvs({
|
|
22
|
-
piral,
|
|
23
|
-
dependencies: externals,
|
|
24
|
-
production: true,
|
|
25
|
-
debugPiral: true,
|
|
26
|
-
debugPilet: true,
|
|
27
|
-
root,
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const otherConfigPath = resolve(root, defaultWebpackConfig);
|
|
31
|
-
const hmrPort = hmr ? await getFreePort(62123) : 0;
|
|
32
|
-
const baseConfig = await getPiralConfig(
|
|
33
|
-
root,
|
|
34
|
-
entryFiles,
|
|
35
|
-
outDir,
|
|
36
|
-
externals,
|
|
37
|
-
true,
|
|
38
|
-
true,
|
|
39
|
-
false,
|
|
40
|
-
false,
|
|
41
|
-
undefined,
|
|
42
|
-
hmrPort,
|
|
43
|
-
);
|
|
44
|
-
const wpConfig = extendConfig(baseConfig, otherConfigPath, {
|
|
45
|
-
watch: true,
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const bundler = runWebpack(wpConfig, logLevel);
|
|
49
|
-
const bundle = await bundler.bundle();
|
|
50
|
-
logReset();
|
|
51
|
-
return bundle;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
process.on('message', async (msg) => {
|
|
55
|
-
switch (msg.type) {
|
|
56
|
-
case 'start':
|
|
57
|
-
const result = await run(process.cwd(), msg.piral, true, msg.externals, msg.entryFiles, msg.logLevel).catch(
|
|
58
|
-
(error) => {
|
|
59
|
-
process.send({
|
|
60
|
-
type: 'fail',
|
|
61
|
-
error: error?.message,
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
if (result) {
|
|
67
|
-
process.send({
|
|
68
|
-
type: 'done',
|
|
69
|
-
outDir: result.outDir,
|
|
70
|
-
outFile: result.outFile,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
});
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import type { PiletSchemaVersion, LogLevels } from 'piral-cli';
|
|
2
|
-
import { setStandardEnvs } from 'piral-cli/utils';
|
|
3
|
-
import { resolve } from 'path';
|
|
4
|
-
import { runWebpack } from './bundler-run';
|
|
5
|
-
import { getPiletConfig } from '../configs';
|
|
6
|
-
import { extendConfig } from '../helpers';
|
|
7
|
-
import { defaultWebpackConfig } from '../constants';
|
|
8
|
-
|
|
9
|
-
async function run(
|
|
10
|
-
root: string,
|
|
11
|
-
piral: string,
|
|
12
|
-
externals: Array<string>,
|
|
13
|
-
entryModule: string,
|
|
14
|
-
version: PiletSchemaVersion,
|
|
15
|
-
logLevel: LogLevels,
|
|
16
|
-
) {
|
|
17
|
-
setStandardEnvs({
|
|
18
|
-
piral,
|
|
19
|
-
root,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const otherConfigPath = resolve(root, defaultWebpackConfig);
|
|
23
|
-
const dist = resolve(root, 'dist');
|
|
24
|
-
const baseConfig = await getPiletConfig(
|
|
25
|
-
root,
|
|
26
|
-
entryModule,
|
|
27
|
-
dist,
|
|
28
|
-
'index.js',
|
|
29
|
-
externals,
|
|
30
|
-
piral,
|
|
31
|
-
version,
|
|
32
|
-
true,
|
|
33
|
-
true,
|
|
34
|
-
true,
|
|
35
|
-
false,
|
|
36
|
-
);
|
|
37
|
-
const wpConfig = extendConfig(baseConfig, otherConfigPath, {
|
|
38
|
-
watch: true,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
return runWebpack(wpConfig, logLevel);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
let bundler;
|
|
45
|
-
|
|
46
|
-
process.on('message', async (msg) => {
|
|
47
|
-
const root = process.cwd();
|
|
48
|
-
|
|
49
|
-
switch (msg.type) {
|
|
50
|
-
case 'bundle':
|
|
51
|
-
if (bundler) {
|
|
52
|
-
await bundler.bundle();
|
|
53
|
-
|
|
54
|
-
bundler.on('buildStart', () => {
|
|
55
|
-
process.send({
|
|
56
|
-
type: 'pending',
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
break;
|
|
62
|
-
case 'start':
|
|
63
|
-
bundler = await run(root, msg.piral, msg.externals, msg.entryModule, msg.version, msg.logLevel).catch((error) => {
|
|
64
|
-
process.send({
|
|
65
|
-
type: 'fail',
|
|
66
|
-
error: error?.message,
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
if (bundler) {
|
|
71
|
-
bundler.on('bundled', async () => {
|
|
72
|
-
if (msg.hmr) {
|
|
73
|
-
process.send({
|
|
74
|
-
type: 'update',
|
|
75
|
-
outHash: bundler.mainBundle.entryAsset.hash,
|
|
76
|
-
outName: bundler.mainBundle.name.substr(bundler.options.outDir.length),
|
|
77
|
-
args: {
|
|
78
|
-
requireRef: bundler.mainBundle.requireRef,
|
|
79
|
-
version: msg.version,
|
|
80
|
-
root,
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
process.send({
|
|
87
|
-
type: 'done',
|
|
88
|
-
outDir: bundler.options.outDir,
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
});
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import type { LogLevels } from 'piral-cli';
|
|
2
|
-
import { setStandardEnvs, getFreePort } from 'piral-cli/utils';
|
|
3
|
-
import { resolve } from 'path';
|
|
4
|
-
import { runWebpack } from './bundler-run';
|
|
5
|
-
import { getPiralConfig } from '../configs';
|
|
6
|
-
import { extendConfig } from '../helpers';
|
|
7
|
-
import { defaultWebpackConfig } from '../constants';
|
|
8
|
-
|
|
9
|
-
async function run(
|
|
10
|
-
root: string,
|
|
11
|
-
piral: string,
|
|
12
|
-
hmr: boolean,
|
|
13
|
-
externals: Array<string>,
|
|
14
|
-
publicUrl: string,
|
|
15
|
-
entryFiles: string,
|
|
16
|
-
logLevel: LogLevels,
|
|
17
|
-
) {
|
|
18
|
-
setStandardEnvs({
|
|
19
|
-
root,
|
|
20
|
-
debugPiral: true,
|
|
21
|
-
dependencies: externals,
|
|
22
|
-
piral,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const otherConfigPath = resolve(root, defaultWebpackConfig);
|
|
26
|
-
const dist = resolve(root, 'dist');
|
|
27
|
-
const hmrPort = hmr ? await getFreePort(62123) : 0;
|
|
28
|
-
const baseConfig = await getPiralConfig(
|
|
29
|
-
root,
|
|
30
|
-
entryFiles,
|
|
31
|
-
dist,
|
|
32
|
-
externals,
|
|
33
|
-
true,
|
|
34
|
-
true,
|
|
35
|
-
false,
|
|
36
|
-
false,
|
|
37
|
-
publicUrl,
|
|
38
|
-
hmrPort,
|
|
39
|
-
);
|
|
40
|
-
const wpConfig = extendConfig(baseConfig, otherConfigPath, {
|
|
41
|
-
watch: true,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
return runWebpack(wpConfig, logLevel);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
let bundler;
|
|
48
|
-
|
|
49
|
-
process.on('message', async (msg) => {
|
|
50
|
-
const root = process.cwd();
|
|
51
|
-
|
|
52
|
-
switch (msg.type) {
|
|
53
|
-
case 'bundle':
|
|
54
|
-
if (bundler) {
|
|
55
|
-
await bundler.bundle();
|
|
56
|
-
|
|
57
|
-
bundler.on('buildStart', () => {
|
|
58
|
-
process.send({
|
|
59
|
-
type: 'pending',
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
break;
|
|
65
|
-
case 'start':
|
|
66
|
-
bundler = await run(root, msg.piral, msg.hmr, msg.externals, msg.publicUrl, msg.entryFiles, msg.logLevel).catch(
|
|
67
|
-
(error) => {
|
|
68
|
-
process.send({
|
|
69
|
-
type: 'fail',
|
|
70
|
-
error: error?.message,
|
|
71
|
-
});
|
|
72
|
-
},
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
if (bundler) {
|
|
76
|
-
bundler.on('bundled', () => {
|
|
77
|
-
process.send({
|
|
78
|
-
type: 'update',
|
|
79
|
-
outHash: bundler.mainBundle.entryAsset.hash,
|
|
80
|
-
outName: 'index.html',
|
|
81
|
-
args: {
|
|
82
|
-
root,
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
process.send({
|
|
88
|
-
type: 'done',
|
|
89
|
-
outDir: bundler.options.outDir,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
File without changes
|