piral-cli-webpack5 0.14.0-unstable.3065 → 0.14.1-beta.3244

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.
Files changed (75) hide show
  1. package/README.md +20 -0
  2. package/extend-config.js +57 -15
  3. package/lib/actions.js +6 -40
  4. package/lib/actions.js.map +1 -1
  5. package/lib/enhancers/html5-entry-webpack-config-enhancer/helpers.d.ts +1 -1
  6. package/lib/enhancers/html5-entry-webpack-config-enhancer/helpers.js.map +1 -1
  7. package/lib/enhancers/html5-entry-webpack-config-enhancer/index.js.map +1 -1
  8. package/lib/enhancers/pilet-webpack-config-enhancer/index.js +20 -2
  9. package/lib/enhancers/pilet-webpack-config-enhancer/index.js.map +1 -1
  10. package/lib/helpers.d.ts +1 -1
  11. package/lib/{configs → plugins}/SheetPlugin.d.ts +3 -1
  12. package/lib/plugins/SheetPlugin.js +44 -0
  13. package/lib/plugins/SheetPlugin.js.map +1 -0
  14. package/lib/webpack/bundler-run.d.ts +2 -21
  15. package/lib/webpack/bundler-run.js +44 -44
  16. package/lib/webpack/bundler-run.js.map +1 -1
  17. package/lib/{configs → webpack}/common.d.ts +0 -0
  18. package/lib/{configs → webpack}/common.js +3 -2
  19. package/lib/webpack/common.js.map +1 -0
  20. package/lib/webpack/pilet.d.ts +19 -0
  21. package/lib/{configs → webpack}/pilet.js +19 -3
  22. package/lib/webpack/pilet.js.map +1 -0
  23. package/lib/webpack/piral.d.ts +16 -0
  24. package/lib/{configs → webpack}/piral.js +21 -3
  25. package/lib/{configs → webpack}/piral.js.map +1 -1
  26. package/package.json +8 -8
  27. package/src/actions.ts +6 -21
  28. package/src/enhancers/html5-entry-webpack-config-enhancer/helpers.ts +1 -1
  29. package/src/enhancers/html5-entry-webpack-config-enhancer/index.ts +20 -21
  30. package/src/enhancers/pilet-webpack-config-enhancer/index.ts +27 -2
  31. package/src/helpers.ts +1 -1
  32. package/src/plugins/SheetPlugin.ts +46 -0
  33. package/src/webpack/bundler-run.ts +49 -55
  34. package/src/{configs → webpack}/common.ts +3 -2
  35. package/src/{configs → webpack}/pilet.ts +32 -1
  36. package/src/{configs → webpack}/piral.ts +32 -1
  37. package/lib/configs/SheetPlugin.js +0 -23
  38. package/lib/configs/SheetPlugin.js.map +0 -1
  39. package/lib/configs/common.js.map +0 -1
  40. package/lib/configs/index.d.ts +0 -2
  41. package/lib/configs/index.js +0 -15
  42. package/lib/configs/index.js.map +0 -1
  43. package/lib/configs/pilet.d.ts +0 -3
  44. package/lib/configs/pilet.js.map +0 -1
  45. package/lib/configs/piral.d.ts +0 -2
  46. package/lib/webpack/bundler-calls.d.ts +0 -3
  47. package/lib/webpack/bundler-calls.js +0 -93
  48. package/lib/webpack/bundler-calls.js.map +0 -1
  49. package/lib/webpack/index.d.ts +0 -1
  50. package/lib/webpack/index.js +0 -14
  51. package/lib/webpack/index.js.map +0 -1
  52. package/lib/webpack/run-build-pilet.d.ts +0 -1
  53. package/lib/webpack/run-build-pilet.js +0 -53
  54. package/lib/webpack/run-build-pilet.js.map +0 -1
  55. package/lib/webpack/run-build-piral.d.ts +0 -1
  56. package/lib/webpack/run-build-piral.js +0 -56
  57. package/lib/webpack/run-build-piral.js.map +0 -1
  58. package/lib/webpack/run-debug-mono-piral.d.ts +0 -1
  59. package/lib/webpack/run-debug-mono-piral.js +0 -61
  60. package/lib/webpack/run-debug-mono-piral.js.map +0 -1
  61. package/lib/webpack/run-debug-pilet.d.ts +0 -1
  62. package/lib/webpack/run-debug-pilet.js +0 -77
  63. package/lib/webpack/run-debug-pilet.js.map +0 -1
  64. package/lib/webpack/run-debug-piral.d.ts +0 -1
  65. package/lib/webpack/run-debug-piral.js +0 -76
  66. package/lib/webpack/run-debug-piral.js.map +0 -1
  67. package/src/configs/SheetPlugin.ts +0 -21
  68. package/src/configs/index.ts +0 -2
  69. package/src/webpack/bundler-calls.ts +0 -107
  70. package/src/webpack/index.ts +0 -1
  71. package/src/webpack/run-build-pilet.ts +0 -84
  72. package/src/webpack/run-build-piral.ts +0 -82
  73. package/src/webpack/run-debug-mono-piral.ts +0 -65
  74. package/src/webpack/run-debug-pilet.ts +0 -95
  75. package/src/webpack/run-debug-piral.ts +0 -84
@@ -1,84 +0,0 @@
1
- import type { PiletSchemaVersion, LogLevels, SharedDependency } 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
- sourceMaps: boolean,
13
- contentHash: boolean,
14
- minify: boolean,
15
- externals: Array<string>,
16
- importmap: Array<SharedDependency>,
17
- outDir: string,
18
- outFile: string,
19
- entryModule: string,
20
- version: PiletSchemaVersion,
21
- logLevel: LogLevels,
22
- ) {
23
- setStandardEnvs({
24
- production: true,
25
- piral,
26
- root,
27
- });
28
-
29
- const otherConfigPath = resolve(root, defaultWebpackConfig);
30
- const baseConfig = await getPiletConfig(
31
- entryModule,
32
- outDir,
33
- outFile,
34
- externals,
35
- importmap,
36
- piral,
37
- version,
38
- false,
39
- sourceMaps,
40
- contentHash,
41
- minify,
42
- );
43
- const wpConfig = extendConfig(baseConfig, otherConfigPath, {
44
- watch: false,
45
- });
46
-
47
- const bundler = runWebpack(wpConfig, logLevel);
48
- return await 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.sourceMaps,
58
- msg.contentHash,
59
- msg.minify,
60
- msg.externals,
61
- msg.importmap,
62
- msg.outDir,
63
- msg.outFile,
64
- msg.entryModule,
65
- msg.version,
66
- msg.logLevel,
67
- ).catch((error) => {
68
- process.send({
69
- type: 'fail',
70
- error: error?.message,
71
- });
72
- });
73
-
74
- if (result) {
75
- process.send({
76
- type: 'done',
77
- outDir: result.outDir,
78
- outFile: result.outFile,
79
- });
80
- }
81
-
82
- break;
83
- }
84
- });
@@ -1,82 +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
- entryFiles,
34
- outDir,
35
- externals,
36
- emulator,
37
- sourceMaps,
38
- contentHash,
39
- minify,
40
- publicUrl,
41
- );
42
- const wpConfig = extendConfig(baseConfig, otherConfigPath, {
43
- watch: false,
44
- });
45
-
46
- const bundler = runWebpack(wpConfig, logLevel);
47
- return bundler.bundle();
48
- }
49
-
50
- process.on('message', async (msg) => {
51
- switch (msg.type) {
52
- case 'start':
53
- const result = await run(
54
- process.cwd(),
55
- msg.piral,
56
- msg.emulator,
57
- msg.sourceMaps,
58
- msg.contentHash,
59
- msg.minify,
60
- msg.externals,
61
- msg.publicUrl,
62
- msg.outDir,
63
- msg.entryFiles,
64
- msg.logLevel,
65
- ).catch((error) => {
66
- process.send({
67
- type: 'fail',
68
- error: error?.message,
69
- });
70
- });
71
-
72
- if (result) {
73
- process.send({
74
- type: 'done',
75
- outDir: result.outDir,
76
- outFile: result.outFile,
77
- });
78
- }
79
-
80
- break;
81
- }
82
- });
@@ -1,65 +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: false,
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(entryFiles, outDir, externals, true, true, false, false, undefined, hmrPort);
33
- const wpConfig = extendConfig(baseConfig, otherConfigPath, {
34
- watch: true,
35
- });
36
-
37
- const bundler = runWebpack(wpConfig, logLevel);
38
- const bundle = await bundler.bundle();
39
- logReset();
40
- return bundle;
41
- }
42
-
43
- process.on('message', async (msg) => {
44
- switch (msg.type) {
45
- case 'start':
46
- const result = await run(process.cwd(), msg.piral, true, msg.externals, msg.entryFiles, msg.logLevel).catch(
47
- (error) => {
48
- process.send({
49
- type: 'fail',
50
- error: error?.message,
51
- });
52
- },
53
- );
54
-
55
- if (result) {
56
- process.send({
57
- type: 'done',
58
- outDir: result.outDir,
59
- outFile: result.outFile,
60
- });
61
- }
62
-
63
- break;
64
- }
65
- });
@@ -1,95 +0,0 @@
1
- import type { PiletSchemaVersion, LogLevels, SharedDependency } 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
- importmap: Array<SharedDependency>,
14
- entryModule: string,
15
- version: PiletSchemaVersion,
16
- logLevel: LogLevels,
17
- ) {
18
- setStandardEnvs({
19
- piral,
20
- root,
21
- });
22
-
23
- const otherConfigPath = resolve(root, defaultWebpackConfig);
24
- const dist = resolve(root, 'dist');
25
- const baseConfig = await getPiletConfig(
26
- entryModule,
27
- dist,
28
- 'index.js',
29
- externals,
30
- importmap,
31
- piral,
32
- version,
33
- true,
34
- true,
35
- true,
36
- false,
37
- );
38
- const wpConfig = extendConfig(baseConfig, otherConfigPath, {
39
- watch: true,
40
- });
41
-
42
- return runWebpack(wpConfig, logLevel);
43
- }
44
-
45
- let bundler;
46
-
47
- process.on('message', async (msg) => {
48
- const root = process.cwd();
49
-
50
- switch (msg.type) {
51
- case 'bundle':
52
- if (bundler) {
53
- await bundler.bundle();
54
-
55
- bundler.on('buildStart', () => {
56
- process.send({
57
- type: 'pending',
58
- });
59
- });
60
- }
61
-
62
- break;
63
- case 'start':
64
- bundler = await run(root, msg.piral, msg.externals, msg.importmap, msg.entryModule, msg.version, msg.logLevel).catch((error) => {
65
- process.send({
66
- type: 'fail',
67
- error: error?.message,
68
- });
69
- });
70
-
71
- if (bundler) {
72
- bundler.on('bundled', async () => {
73
- if (msg.hmr) {
74
- process.send({
75
- type: 'update',
76
- outHash: bundler.mainBundle.entryAsset.hash,
77
- outName: bundler.mainBundle.name.substr(bundler.options.outDir.length),
78
- args: {
79
- requireRef: bundler.mainBundle.requireRef,
80
- version: msg.version,
81
- root,
82
- },
83
- });
84
- }
85
- });
86
-
87
- process.send({
88
- type: 'done',
89
- outDir: bundler.options.outDir,
90
- });
91
- }
92
-
93
- break;
94
- }
95
- });
@@ -1,84 +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(entryFiles, dist, externals, true, true, false, false, publicUrl, hmrPort);
29
- const wpConfig = extendConfig(baseConfig, otherConfigPath, {
30
- watch: true,
31
- });
32
-
33
- return runWebpack(wpConfig, logLevel);
34
- }
35
-
36
- let bundler;
37
-
38
- process.on('message', async (msg) => {
39
- const root = process.cwd();
40
-
41
- switch (msg.type) {
42
- case 'bundle':
43
- if (bundler) {
44
- await bundler.bundle();
45
-
46
- bundler.on('buildStart', () => {
47
- process.send({
48
- type: 'pending',
49
- });
50
- });
51
- }
52
-
53
- break;
54
- case 'start':
55
- bundler = await run(root, msg.piral, msg.hmr, msg.externals, msg.publicUrl, msg.entryFiles, msg.logLevel).catch(
56
- (error) => {
57
- process.send({
58
- type: 'fail',
59
- error: error?.message,
60
- });
61
- },
62
- );
63
-
64
- if (bundler) {
65
- bundler.on('bundled', () => {
66
- process.send({
67
- type: 'update',
68
- outHash: bundler.mainBundle.entryAsset.hash,
69
- outName: 'index.html',
70
- args: {
71
- root,
72
- },
73
- });
74
- });
75
-
76
- process.send({
77
- type: 'done',
78
- outDir: bundler.options.outDir,
79
- });
80
- }
81
-
82
- break;
83
- }
84
- });