piral-cli 1.0.0-pre.2296 → 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 +30 -7
- package/lib/api.js +23 -23
- package/lib/api.js.map +1 -1
- package/lib/apps/add-piral-instance-pilet.d.ts +26 -0
- package/lib/apps/add-piral-instance-pilet.js +53 -0
- package/lib/apps/add-piral-instance-pilet.js.map +1 -0
- package/lib/apps/build-pilet.d.ts +33 -2
- package/lib/apps/build-pilet.js +159 -32
- package/lib/apps/build-pilet.js.map +1 -1
- package/lib/apps/build-piral.d.ts +18 -1
- package/lib/apps/build-piral.js +68 -52
- package/lib/apps/build-piral.js.map +1 -1
- package/lib/apps/debug-pilet.d.ts +38 -2
- package/lib/apps/debug-pilet.js +150 -108
- package/lib/apps/debug-pilet.js.map +1 -1
- package/lib/apps/debug-piral.d.ts +23 -0
- package/lib/apps/debug-piral.js +63 -52
- package/lib/apps/debug-piral.js.map +1 -1
- package/lib/apps/declaration-piral.js +5 -3
- package/lib/apps/declaration-piral.js.map +1 -1
- package/lib/apps/index.d.ts +3 -0
- package/lib/apps/index.js +8 -1
- package/lib/apps/index.js.map +1 -1
- package/lib/apps/new-pilet.d.ts +7 -3
- package/lib/apps/new-pilet.js +47 -52
- package/lib/apps/new-pilet.js.map +1 -1
- package/lib/apps/new-piral.d.ts +7 -3
- package/lib/apps/new-piral.js +33 -23
- package/lib/apps/new-piral.js.map +1 -1
- package/lib/apps/pack-pilet.d.ts +9 -0
- package/lib/apps/pack-pilet.js +6 -13
- package/lib/apps/pack-pilet.js.map +1 -1
- package/lib/apps/publish-pilet.d.ts +23 -3
- package/lib/apps/publish-pilet.js +112 -62
- package/lib/apps/publish-pilet.js.map +1 -1
- package/lib/apps/publish-piral.d.ts +6 -2
- package/lib/apps/publish-piral.js +30 -26
- package/lib/apps/publish-piral.js.map +1 -1
- package/lib/apps/remove-piral-instance-pilet.d.ts +22 -0
- package/lib/apps/remove-piral-instance-pilet.js +52 -0
- package/lib/apps/remove-piral-instance-pilet.js.map +1 -0
- package/lib/apps/run-emulator-piral.d.ts +34 -0
- package/lib/apps/run-emulator-piral.js +91 -0
- package/lib/apps/run-emulator-piral.js.map +1 -0
- package/lib/apps/upgrade-pilet.d.ts +6 -2
- package/lib/apps/upgrade-pilet.js +41 -43
- package/lib/apps/upgrade-pilet.js.map +1 -1
- package/lib/apps/upgrade-piral.d.ts +2 -2
- package/lib/apps/upgrade-piral.js +21 -20
- package/lib/apps/upgrade-piral.js.map +1 -1
- package/lib/apps/validate-pilet.js +30 -36
- package/lib/apps/validate-pilet.js.map +1 -1
- package/lib/apps/validate-piral.js +13 -10
- package/lib/apps/validate-piral.js.map +1 -1
- package/lib/build/bundler-calls.d.ts +3 -0
- package/lib/build/bundler-calls.js +117 -0
- package/lib/build/bundler-calls.js.map +1 -0
- package/lib/build/run-build-pilet.d.ts +1 -0
- package/lib/build/run-build-pilet.js +65 -0
- package/lib/build/run-build-pilet.js.map +1 -0
- package/lib/build/run-build-piral.d.ts +1 -0
- package/lib/build/run-build-piral.js +67 -0
- package/lib/build/run-build-piral.js.map +1 -0
- package/lib/build/run-debug-mono-piral.d.ts +1 -0
- package/lib/build/run-debug-mono-piral.js +70 -0
- package/lib/build/run-debug-mono-piral.js.map +1 -0
- package/lib/build/run-debug-pilet.d.ts +1 -0
- package/lib/build/run-debug-pilet.js +89 -0
- package/lib/build/run-debug-pilet.js.map +1 -0
- package/lib/build/run-debug-piral.d.ts +1 -0
- package/lib/build/run-debug-piral.js +85 -0
- package/lib/build/run-debug-piral.js.map +1 -0
- package/lib/bundler.js +75 -26
- package/lib/bundler.js.map +1 -1
- package/lib/cli.js +7 -4
- package/lib/cli.js.map +1 -1
- package/lib/commands.js +266 -46
- package/lib/commands.js.map +1 -1
- package/lib/common/archive.d.ts +4 -0
- package/lib/common/archive.js +31 -10
- package/lib/common/archive.js.map +1 -1
- package/lib/common/browser.d.ts +2 -1
- package/lib/common/browser.js +17 -8
- package/lib/common/browser.js.map +1 -1
- package/lib/common/clients/index.d.ts +21 -0
- package/lib/common/clients/index.js +48 -0
- package/lib/common/clients/index.js.map +1 -0
- package/lib/common/clients/lerna.d.ts +7 -1
- package/lib/common/clients/lerna.js +93 -7
- package/lib/common/clients/lerna.js.map +1 -1
- package/lib/common/clients/npm.d.ts +6 -1
- package/lib/common/clients/npm.js +66 -18
- package/lib/common/clients/npm.js.map +1 -1
- package/lib/common/clients/pnp.d.ts +7 -0
- package/lib/common/clients/pnp.js +104 -0
- package/lib/common/clients/pnp.js.map +1 -0
- package/lib/common/clients/pnpm.d.ts +5 -0
- package/lib/common/clients/pnpm.js +55 -6
- package/lib/common/clients/pnpm.js.map +1 -1
- package/lib/common/clients/rush.d.ts +7 -0
- package/lib/common/clients/rush.js +127 -0
- package/lib/common/clients/rush.js.map +1 -0
- package/lib/common/clients/yarn.d.ts +5 -0
- package/lib/common/clients/yarn.js +57 -6
- package/lib/common/clients/yarn.js.map +1 -1
- package/lib/common/compatibility.js +14 -9
- package/lib/common/compatibility.js.map +1 -1
- package/lib/common/config.d.ts +52 -1
- package/lib/common/config.js +10 -30
- package/lib/common/config.js.map +1 -1
- package/lib/common/constants.d.ts +10 -2
- package/lib/common/constants.js +22 -4
- package/lib/common/constants.js.map +1 -1
- package/lib/common/declaration.d.ts +2 -1
- package/lib/common/declaration.js +113 -56
- package/lib/common/declaration.js.map +1 -1
- package/lib/common/emoji.d.ts +8 -0
- package/lib/common/emoji.js +10 -1
- package/lib/common/emoji.js.map +1 -1
- package/lib/common/emulator.d.ts +2 -2
- package/lib/common/emulator.js +45 -32
- package/lib/common/emulator.js.map +1 -1
- package/lib/common/enums.d.ts +0 -4
- package/lib/common/enums.js +1 -6
- package/lib/common/enums.js.map +1 -1
- package/lib/common/envs.js +16 -5
- package/lib/common/envs.js.map +1 -1
- package/lib/common/hash.d.ts +1 -0
- package/lib/common/hash.js +8 -3
- package/lib/common/hash.js.map +1 -1
- package/lib/common/http.d.ts +5 -2
- package/lib/common/http.js +65 -23
- package/lib/common/http.js.map +1 -1
- package/lib/common/importmap.d.ts +2 -0
- package/lib/common/importmap.js +202 -0
- package/lib/common/importmap.js.map +1 -0
- package/lib/common/index.d.ts +10 -0
- package/lib/common/index.js +15 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/info.d.ts +5 -0
- package/lib/common/info.js +9 -2
- package/lib/common/info.js.map +1 -1
- package/lib/common/injectors.d.ts +36 -8
- package/lib/common/injectors.js +46 -19
- package/lib/common/injectors.js.map +1 -1
- package/lib/common/inspect.d.ts +5 -3
- package/lib/common/inspect.js +15 -15
- package/lib/common/inspect.js.map +1 -1
- package/lib/common/interactive.d.ts +9 -0
- package/lib/common/interactive.js +60 -1
- package/lib/common/interactive.js.map +1 -1
- package/lib/common/io.d.ts +9 -3
- package/lib/common/io.js +219 -116
- package/lib/common/io.js.map +1 -1
- package/lib/common/language.d.ts +9 -6
- package/lib/common/language.js +68 -12
- package/lib/common/language.js.map +1 -1
- package/lib/common/log.d.ts +5 -3
- package/lib/common/log.js +34 -48
- package/lib/common/log.js.map +1 -1
- package/lib/common/npm.d.ts +17 -16
- package/lib/common/npm.js +262 -158
- package/lib/common/npm.js.map +1 -1
- package/lib/common/pack.js +47 -26
- package/lib/common/pack.js.map +1 -1
- package/lib/common/package.d.ts +43 -20
- package/lib/common/package.js +377 -213
- package/lib/common/package.js.map +1 -1
- package/lib/common/parallel.d.ts +1 -0
- package/lib/common/parallel.js +29 -0
- package/lib/common/parallel.js.map +1 -0
- package/lib/common/patcher.js +20 -20
- package/lib/common/patcher.js.map +1 -1
- package/lib/common/platform.d.ts +13 -0
- package/lib/common/platform.js +29 -0
- package/lib/common/platform.js.map +1 -0
- package/lib/common/port.d.ts +1 -0
- package/lib/common/port.js +14 -4
- package/lib/common/port.js.map +1 -1
- package/lib/common/rules.js +4 -4
- package/lib/common/rules.js.map +1 -1
- package/lib/common/scaffold.d.ts +18 -4
- package/lib/common/scaffold.js +59 -36
- package/lib/common/scaffold.js.map +1 -1
- package/lib/common/scripts.js +8 -8
- package/lib/common/scripts.js.map +1 -1
- package/lib/common/shell.d.ts +2 -0
- package/lib/common/shell.js +33 -0
- package/lib/common/shell.js.map +1 -0
- package/lib/common/spec.d.ts +29 -0
- package/lib/common/spec.js +69 -0
- package/lib/common/spec.js.map +1 -0
- package/lib/common/template.d.ts +1 -2
- package/lib/common/template.js +23 -22
- package/lib/common/template.js.map +1 -1
- package/lib/common/url.d.ts +1 -0
- package/lib/common/url.js +17 -0
- package/lib/common/url.js.map +1 -0
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.js +8 -0
- package/lib/common/utils.js.map +1 -0
- package/lib/common/version.d.ts +2 -0
- package/lib/common/version.js +130 -0
- package/lib/common/version.js.map +1 -0
- package/lib/common/watcher.d.ts +13 -0
- package/lib/common/watcher.js +78 -0
- package/lib/common/watcher.js.map +1 -0
- package/lib/external/index.js +59413 -57862
- package/lib/helpers.d.ts +6 -6
- package/lib/helpers.js +10 -25
- package/lib/helpers.js.map +1 -1
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/inject.js +2 -2
- package/lib/inject.js.map +1 -1
- package/lib/injectors/pilet-injector.d.ts +75 -0
- package/lib/injectors/pilet-injector.js +246 -0
- package/lib/injectors/pilet-injector.js.map +1 -0
- package/lib/injectors/{piral.d.ts → piral-injector.d.ts} +10 -2
- package/lib/injectors/piral-injector.js +97 -0
- package/lib/injectors/piral-injector.js.map +1 -0
- package/lib/messages.d.ts +567 -47
- package/lib/messages.js +638 -51
- package/lib/messages.js.map +1 -1
- package/lib/pb-cli.js +1 -1
- package/lib/pb-cli.js.map +1 -1
- package/lib/pilet-cli.js +1 -1
- package/lib/pilet-cli.js.map +1 -1
- package/lib/piral-cli.js +1 -1
- package/lib/piral-cli.js.map +1 -1
- package/lib/platforms/node.d.ts +8 -0
- package/lib/platforms/node.js +30 -0
- package/lib/platforms/node.js.map +1 -0
- package/lib/platforms/web.d.ts +8 -0
- package/lib/platforms/web.js +120 -0
- package/lib/platforms/web.js.map +1 -0
- package/lib/plugin.js +36 -11
- package/lib/plugin.js.map +1 -1
- package/lib/questionnaire.d.ts +1 -1
- package/lib/questionnaire.js +9 -4
- package/lib/questionnaire.js.map +1 -1
- package/lib/release.d.ts +1 -1
- package/lib/release.js +38 -6
- package/lib/release.js.map +1 -1
- package/lib/resolvers.js +13 -13
- package/lib/resolvers.js.map +1 -1
- package/lib/rules/index.js +8 -8
- package/lib/rules/index.js.map +1 -1
- package/lib/rules/pilet-has-externals-as-peers.d.ts +1 -1
- package/lib/rules/pilet-has-externals-as-peers.js +9 -7
- package/lib/rules/pilet-has-externals-as-peers.js.map +1 -1
- package/lib/rules/pilet-has-no-self-reference.d.ts +1 -1
- package/lib/rules/pilet-has-no-self-reference.js +2 -2
- package/lib/rules/pilet-has-no-self-reference.js.map +1 -1
- package/lib/rules/pilet-has-no-third-party-dependency.d.ts +1 -1
- package/lib/rules/pilet-stays-small.d.ts +1 -1
- package/lib/rules/pilet-stays-small.js +4 -4
- package/lib/rules/pilet-stays-small.js.map +1 -1
- package/lib/rules/pilet-uses-latest-piral.d.ts +1 -1
- package/lib/rules/pilet-uses-latest-piral.js +18 -9
- package/lib/rules/pilet-uses-latest-piral.js.map +1 -1
- package/lib/rules/piral-depends-on-piral.d.ts +1 -1
- package/lib/rules/piral-entry-ends-with-html.d.ts +1 -1
- package/lib/rules/piral-entry-ends-with-html.js +1 -1
- package/lib/rules/piral-entry-ends-with-html.js.map +1 -1
- package/lib/rules/piral-has-valid-devDependencies.d.ts +1 -1
- package/lib/rules/piral-has-valid-externals.d.ts +1 -1
- package/lib/rules/piral-has-valid-externals.js +10 -24
- package/lib/rules/piral-has-valid-externals.js.map +1 -1
- package/lib/rules/piral-has-valid-files.d.ts +1 -1
- package/lib/rules/piral-has-valid-files.js +5 -5
- package/lib/rules/piral-has-valid-files.js.map +1 -1
- package/lib/rules/piral-has-valid-scripts.d.ts +1 -1
- package/lib/runner.js +1 -1
- package/lib/runner.js.map +1 -1
- package/lib/select.js +6 -6
- package/lib/select.js.map +1 -1
- package/lib/types/common.d.ts +88 -8
- package/lib/types/common.js.map +1 -1
- package/lib/types/index.js +5 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/internal.d.ts +12 -13
- package/lib/types/public.d.ts +89 -23
- package/package.json +19 -16
- package/src/apps/add-piral-instance-pilet.ts +98 -0
- package/src/apps/build-pilet.ts +286 -38
- package/src/apps/build-piral.test.ts +20 -7
- package/src/apps/build-piral.ts +90 -39
- package/src/apps/debug-pilet.ts +229 -123
- package/src/apps/debug-piral.ts +121 -68
- package/src/apps/declaration-piral.ts +4 -2
- package/src/apps/index.ts +3 -0
- package/src/apps/new-pilet.test.ts +28 -11
- package/src/apps/new-pilet.ts +60 -48
- package/src/apps/new-piral.test.ts +25 -13
- package/src/apps/new-piral.ts +43 -19
- package/src/apps/pack-pilet.test.ts +2 -2
- package/src/apps/pack-pilet.ts +12 -10
- package/src/apps/publish-pilet.ts +148 -43
- package/src/apps/publish-piral.ts +38 -11
- package/src/apps/remove-piral-instance-pilet.ts +92 -0
- package/src/apps/run-emulator-piral.ts +154 -0
- package/src/apps/upgrade-pilet.ts +37 -31
- package/src/apps/upgrade-piral.ts +9 -7
- package/src/apps/validate-pilet.ts +30 -22
- package/src/apps/validate-piral.ts +5 -2
- package/src/build/bundler-calls.ts +133 -0
- package/src/build/run-build-pilet.ts +91 -0
- package/src/build/run-build-piral.ts +93 -0
- package/src/build/run-debug-mono-piral.ts +86 -0
- package/src/build/run-debug-pilet.ts +116 -0
- package/src/build/run-debug-piral.ts +105 -0
- package/src/bundler.test.ts +86 -68
- package/src/bundler.ts +74 -19
- package/src/cli.ts +6 -2
- package/src/commands.ts +273 -44
- package/src/common/archive.test.ts +51 -45
- package/src/common/archive.ts +28 -1
- package/src/common/browser.test.ts +20 -10
- package/src/common/browser.ts +13 -6
- package/src/common/clients/index.ts +41 -0
- package/src/common/clients/lerna.ts +85 -1
- package/src/common/clients/npm.ts +56 -14
- package/src/common/clients/pnp.ts +84 -0
- package/src/common/clients/pnpm.ts +45 -1
- package/src/common/clients/rush.ts +118 -0
- package/src/common/clients/yarn.ts +49 -3
- package/src/common/compatibility.ts +8 -1
- package/src/common/config.ts +57 -22
- package/src/common/constants.ts +21 -3
- package/src/common/declaration.ts +124 -50
- package/src/common/emoji.ts +9 -0
- package/src/common/emulator.ts +43 -23
- package/src/common/enums.ts +0 -5
- package/src/common/envs.ts +15 -3
- package/src/common/hash.ts +5 -0
- package/src/common/http.test.ts +76 -64
- package/src/common/http.ts +88 -24
- package/src/common/importmap.ts +242 -0
- package/src/common/index.ts +10 -0
- package/src/common/info.ts +9 -1
- package/src/common/injectors.ts +49 -22
- package/src/common/inspect.ts +13 -14
- package/src/common/interactive.test.ts +6 -0
- package/src/common/interactive.ts +69 -1
- package/src/common/io.ts +199 -82
- package/src/common/language.ts +87 -10
- package/src/common/log.ts +32 -46
- package/src/common/npm.test.ts +187 -166
- package/src/common/npm.ts +263 -119
- package/src/common/pack.test.ts +11 -13
- package/src/common/pack.ts +60 -21
- package/src/common/package.test.ts +59 -49
- package/src/common/package.ts +406 -167
- package/src/common/parallel.test.ts +28 -0
- package/src/common/parallel.ts +21 -0
- package/src/common/platform.ts +31 -0
- package/src/common/port.test.ts +4 -1
- package/src/common/port.ts +10 -0
- package/src/common/rules.test.ts +3 -3
- package/src/common/scaffold.ts +69 -41
- package/src/common/scripts.ts +5 -4
- package/src/common/shell.ts +34 -0
- package/src/common/spec.ts +69 -0
- package/src/common/template.ts +20 -18
- package/src/common/url.test.ts +28 -0
- package/src/common/url.ts +15 -0
- package/src/common/utils.ts +3 -0
- package/src/common/version.test.ts +233 -0
- package/src/common/version.ts +142 -0
- package/src/common/watcher.ts +89 -0
- package/src/external/index.test.ts +2 -2
- package/src/external/index.ts +7 -3
- package/src/external/resolve.ts +29 -0
- package/src/helpers.test.ts +2 -22
- package/src/helpers.ts +21 -30
- package/src/injectors/{pilet.test.ts → pilet-injector.test.ts} +13 -4
- package/src/injectors/pilet-injector.ts +346 -0
- package/src/injectors/{piral.test.ts → piral-injector.test.ts} +14 -5
- package/src/injectors/piral-injector.ts +130 -0
- package/src/messages.ts +649 -63
- package/src/platforms/node.ts +16 -0
- package/src/platforms/web.ts +148 -0
- package/src/plugin.ts +34 -5
- package/src/questionnaire.ts +17 -3
- package/src/release.ts +47 -5
- package/src/rules/index.ts +1 -1
- package/src/rules/pilet-has-externals-as-peers.test.ts +3 -2
- package/src/rules/pilet-has-externals-as-peers.ts +9 -7
- package/src/rules/pilet-has-no-self-reference.ts +1 -1
- package/src/rules/pilet-stays-small.ts +1 -1
- package/src/rules/pilet-uses-latest-piral.ts +22 -12
- package/src/rules/piral-has-valid-externals.ts +10 -29
- package/src/types/common.ts +99 -9
- package/src/types/internal.ts +14 -14
- package/src/types/public.ts +93 -27
- package/lib/external/child.js +0 -144
- package/lib/external/classes.trie +0 -0
- package/lib/external/xdg-open +0 -1066
- package/lib/injectors/pilet.d.ts +0 -47
- package/lib/injectors/pilet.js +0 -187
- package/lib/injectors/pilet.js.map +0 -1
- package/lib/injectors/piral.js +0 -62
- package/lib/injectors/piral.js.map +0 -1
- package/src/injectors/pilet.ts +0 -219
- package/src/injectors/piral.ts +0 -76
- package/templates/piral-index.js.ejs +0 -16
package/src/types/internal.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { LogLevels } from './common';
|
|
1
|
+
import type { LogLevels } from './common';
|
|
2
|
+
import type { PiletSchemaVersion } from './public';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
custom?: any;
|
|
4
|
+
/**
|
|
5
|
+
* Shape of the pilet.json
|
|
6
|
+
*/
|
|
7
|
+
export interface PiletDefinition {
|
|
8
|
+
schemaVersion?: PiletSchemaVersion;
|
|
9
|
+
piralInstances?: Record<
|
|
10
|
+
string,
|
|
11
|
+
{
|
|
12
|
+
selected?: boolean;
|
|
13
|
+
port?: number;
|
|
14
|
+
}
|
|
15
|
+
>;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface PackageFiles {
|
package/src/types/public.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { Argv, Arguments } from 'yargs';
|
|
2
|
-
import {
|
|
3
|
-
RuleRunner,
|
|
4
|
-
PiletRuleContext,
|
|
5
|
-
PiralRuleContext,
|
|
6
|
-
Bundler,
|
|
7
|
-
BundleDetails,
|
|
8
|
-
LogLevels,
|
|
9
|
-
ReleaseProvider,
|
|
10
|
-
} from './common';
|
|
2
|
+
import { RuleRunner, PiletRuleContext, PiralRuleContext, LogLevels, SharedDependency, ReleaseProvider } from './common';
|
|
11
3
|
|
|
12
4
|
export interface ToolCommandRunner<U = {}> {
|
|
13
5
|
(args: Arguments<U>): void | Promise<void>;
|
|
@@ -75,25 +67,30 @@ export interface BaseBundleParameters {
|
|
|
75
67
|
}
|
|
76
68
|
|
|
77
69
|
export interface DebugPiralParameters extends BaseBundleParameters {
|
|
78
|
-
|
|
70
|
+
piralInstances: Array<string>;
|
|
79
71
|
hmr: boolean;
|
|
80
72
|
externals: Array<string>;
|
|
81
73
|
publicUrl: string;
|
|
74
|
+
outFile: string;
|
|
75
|
+
outDir: string;
|
|
82
76
|
entryFiles: string;
|
|
83
77
|
logLevel: LogLevels;
|
|
84
78
|
}
|
|
85
79
|
|
|
86
80
|
export interface WatchPiralParameters extends BaseBundleParameters {
|
|
87
|
-
|
|
81
|
+
piralInstances: Array<string>;
|
|
88
82
|
externals: Array<string>;
|
|
83
|
+
publicUrl: string;
|
|
89
84
|
entryFiles: string;
|
|
90
85
|
logLevel: LogLevels;
|
|
91
86
|
}
|
|
92
87
|
|
|
93
88
|
export interface BuildPiralParameters extends BaseBundleParameters {
|
|
94
|
-
|
|
89
|
+
piralInstances: Array<string>;
|
|
95
90
|
emulator: boolean;
|
|
91
|
+
standalone: boolean;
|
|
96
92
|
sourceMaps: boolean;
|
|
93
|
+
watch: boolean;
|
|
97
94
|
contentHash: boolean;
|
|
98
95
|
minify: boolean;
|
|
99
96
|
externals: Array<string>;
|
|
@@ -105,21 +102,26 @@ export interface BuildPiralParameters extends BaseBundleParameters {
|
|
|
105
102
|
}
|
|
106
103
|
|
|
107
104
|
export interface DebugPiletParameters extends BaseBundleParameters {
|
|
108
|
-
|
|
105
|
+
piralInstances: Array<string>;
|
|
109
106
|
hmr: boolean;
|
|
110
107
|
externals: Array<string>;
|
|
108
|
+
importmap: Array<SharedDependency>;
|
|
111
109
|
targetDir: string;
|
|
110
|
+
outFile: string;
|
|
111
|
+
outDir: string;
|
|
112
112
|
entryModule: string;
|
|
113
113
|
logLevel: LogLevels;
|
|
114
114
|
version: PiletSchemaVersion;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
export interface BuildPiletParameters extends BaseBundleParameters {
|
|
118
|
-
|
|
118
|
+
piralInstances: Array<string>;
|
|
119
119
|
sourceMaps: boolean;
|
|
120
|
+
watch: boolean;
|
|
120
121
|
contentHash: boolean;
|
|
121
122
|
minify: boolean;
|
|
122
123
|
externals: Array<string>;
|
|
124
|
+
importmap: Array<SharedDependency>;
|
|
123
125
|
targetDir: string;
|
|
124
126
|
outFile: string;
|
|
125
127
|
outDir: string;
|
|
@@ -128,28 +130,85 @@ export interface BuildPiletParameters extends BaseBundleParameters {
|
|
|
128
130
|
version: PiletSchemaVersion;
|
|
129
131
|
}
|
|
130
132
|
|
|
131
|
-
export interface
|
|
132
|
-
|
|
133
|
+
export interface BundlerPrepareArgs<T> {
|
|
134
|
+
(args: T): T | Promise<T>;
|
|
133
135
|
}
|
|
134
136
|
|
|
135
|
-
export interface
|
|
137
|
+
export interface BaseBundlerDefinition<T> {
|
|
138
|
+
path: string;
|
|
139
|
+
prepare?: BundlerPrepareArgs<T>;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface WatchPiralBundlerDefinition extends BaseBundlerDefinition<WatchPiralParameters> {}
|
|
143
|
+
|
|
144
|
+
export interface DebugPiralBundlerDefinition extends BaseBundlerDefinition<DebugPiralParameters> {
|
|
136
145
|
flags?: ToolCommandFlagsSetter;
|
|
137
|
-
run(args: DebugPiralParameters): Promise<Bundler>;
|
|
138
146
|
}
|
|
139
147
|
|
|
140
|
-
export interface BuildPiralBundlerDefinition {
|
|
148
|
+
export interface BuildPiralBundlerDefinition extends BaseBundlerDefinition<BuildPiralParameters> {
|
|
141
149
|
flags?: ToolCommandFlagsSetter;
|
|
142
|
-
run(args: BuildPiralParameters): Promise<BundleDetails>;
|
|
143
150
|
}
|
|
144
151
|
|
|
145
|
-
export interface DebugPiletBundlerDefinition {
|
|
152
|
+
export interface DebugPiletBundlerDefinition extends BaseBundlerDefinition<DebugPiletParameters> {
|
|
146
153
|
flags?: ToolCommandFlagsSetter;
|
|
147
|
-
run(args: DebugPiletParameters): Promise<Bundler>;
|
|
148
154
|
}
|
|
149
155
|
|
|
150
|
-
export interface BuildPiletBundlerDefinition {
|
|
156
|
+
export interface BuildPiletBundlerDefinition extends BaseBundlerDefinition<BuildPiletParameters> {
|
|
151
157
|
flags?: ToolCommandFlagsSetter;
|
|
152
|
-
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface PiralBuildHandler {
|
|
161
|
+
create(config: {
|
|
162
|
+
root: string;
|
|
163
|
+
entryFiles: string;
|
|
164
|
+
outDir: string;
|
|
165
|
+
outFile: string;
|
|
166
|
+
externals: Array<string>;
|
|
167
|
+
emulator: boolean;
|
|
168
|
+
sourceMaps: boolean;
|
|
169
|
+
contentHash: boolean;
|
|
170
|
+
minify: boolean;
|
|
171
|
+
publicUrl: string;
|
|
172
|
+
hmr: boolean;
|
|
173
|
+
logLevel: LogLevels;
|
|
174
|
+
watch: boolean;
|
|
175
|
+
args: any;
|
|
176
|
+
}): Promise<BundleHandlerResponse>;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface PiletBuildHandler {
|
|
180
|
+
create(config: {
|
|
181
|
+
root: string;
|
|
182
|
+
piralInstances: Array<string>;
|
|
183
|
+
entryModule: string;
|
|
184
|
+
targetDir: string;
|
|
185
|
+
outDir: string;
|
|
186
|
+
outFile: string;
|
|
187
|
+
externals: Array<string>;
|
|
188
|
+
importmap: Array<SharedDependency>;
|
|
189
|
+
version: PiletSchemaVersion;
|
|
190
|
+
develop: boolean;
|
|
191
|
+
sourceMaps: boolean;
|
|
192
|
+
contentHash: boolean;
|
|
193
|
+
minify: boolean;
|
|
194
|
+
logLevel: LogLevels;
|
|
195
|
+
watch: boolean;
|
|
196
|
+
args: any;
|
|
197
|
+
}): Promise<BundleHandlerResponse>;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface BundleResult {
|
|
201
|
+
outDir: string;
|
|
202
|
+
outFile: string;
|
|
203
|
+
hash?: string;
|
|
204
|
+
name?: string;
|
|
205
|
+
requireRef?: string;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface BundleHandlerResponse {
|
|
209
|
+
onStart(cb: () => void): void;
|
|
210
|
+
onEnd(cb: (result: BundleResult) => void): void;
|
|
211
|
+
bundle(): Promise<BundleResult>;
|
|
153
212
|
}
|
|
154
213
|
|
|
155
214
|
export interface BundlerDefinition {
|
|
@@ -160,15 +219,21 @@ export interface BundlerDefinition {
|
|
|
160
219
|
buildPilet: BuildPiletBundlerDefinition;
|
|
161
220
|
}
|
|
162
221
|
|
|
163
|
-
export type PiletSchemaVersion = 'none' | 'v0' | 'v1';
|
|
222
|
+
export type PiletSchemaVersion = 'none' | 'v0' | 'v1' | 'v2' | 'v3';
|
|
223
|
+
|
|
224
|
+
export type SourceLanguage = 'js' | 'ts';
|
|
225
|
+
|
|
226
|
+
export type PiletPublishScheme = 'none' | 'digest' | 'bearer' | 'basic';
|
|
164
227
|
|
|
165
228
|
export type PiletPublishSource = 'local' | 'npm' | 'remote';
|
|
166
229
|
|
|
167
230
|
export type PiralBuildType = 'all' | 'release' | 'emulator' | 'emulator-sources';
|
|
168
231
|
|
|
232
|
+
export type PiletBuildType = 'default' | 'standalone' | 'manifest';
|
|
233
|
+
|
|
169
234
|
export type PackageType = 'registry' | 'file' | 'git';
|
|
170
235
|
|
|
171
|
-
export type NpmClientType = 'npm' | 'yarn' | 'pnpm';
|
|
236
|
+
export type NpmClientType = 'npm' | 'yarn' | 'pnp' | 'pnpm' | 'lerna' | 'rush';
|
|
172
237
|
|
|
173
238
|
export type Framework = 'piral' | 'piral-core' | 'piral-base';
|
|
174
239
|
|
|
@@ -177,6 +242,7 @@ export interface StandardEnvProps {
|
|
|
177
242
|
debugPiral?: boolean;
|
|
178
243
|
debugPilet?: boolean;
|
|
179
244
|
root: string;
|
|
180
|
-
|
|
245
|
+
publicPath?: string;
|
|
246
|
+
piralInstances?: Array<string>;
|
|
181
247
|
dependencies?: Array<string>;
|
|
182
248
|
}
|
package/lib/external/child.js
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
const {errorUtils} = require('@parcel/utils');
|
|
2
|
-
|
|
3
|
-
class Child {
|
|
4
|
-
constructor() {
|
|
5
|
-
if (!process.send) {
|
|
6
|
-
throw new Error('Only create Child instances in a worker!');
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
this.module = undefined;
|
|
10
|
-
this.childId = undefined;
|
|
11
|
-
|
|
12
|
-
this.callQueue = [];
|
|
13
|
-
this.responseQueue = new Map();
|
|
14
|
-
this.responseId = 0;
|
|
15
|
-
this.maxConcurrentCalls = 10;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
messageListener(data) {
|
|
19
|
-
if (data === 'die') {
|
|
20
|
-
return this.end();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
let type = data.type;
|
|
24
|
-
if (type === 'response') {
|
|
25
|
-
return this.handleResponse(data);
|
|
26
|
-
} else if (type === 'request') {
|
|
27
|
-
return this.handleRequest(data);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
async send(data) {
|
|
32
|
-
process.send(data, err => {
|
|
33
|
-
if (err && err instanceof Error) {
|
|
34
|
-
if (err.code === 'ERR_IPC_CHANNEL_CLOSED') {
|
|
35
|
-
// IPC connection closed
|
|
36
|
-
// no need to keep the worker running if it can't send or receive data
|
|
37
|
-
return this.end();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
childInit(module, childId) {
|
|
44
|
-
this.module = require(module);
|
|
45
|
-
this.childId = childId;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async handleRequest(data) {
|
|
49
|
-
let idx = data.idx;
|
|
50
|
-
let child = data.child;
|
|
51
|
-
let method = data.method;
|
|
52
|
-
let args = data.args;
|
|
53
|
-
|
|
54
|
-
let result = {idx, child, type: 'response'};
|
|
55
|
-
try {
|
|
56
|
-
result.contentType = 'data';
|
|
57
|
-
if (method === 'childInit') {
|
|
58
|
-
result.content = this.childInit(...args, child);
|
|
59
|
-
} else {
|
|
60
|
-
result.content = await this.module[method](...args);
|
|
61
|
-
}
|
|
62
|
-
} catch (e) {
|
|
63
|
-
result.contentType = 'error';
|
|
64
|
-
result.content = errorUtils.errorToJson(e);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
this.send(result);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async handleResponse(data) {
|
|
71
|
-
let idx = data.idx;
|
|
72
|
-
let contentType = data.contentType;
|
|
73
|
-
let content = data.content;
|
|
74
|
-
let call = this.responseQueue.get(idx);
|
|
75
|
-
|
|
76
|
-
if (contentType === 'error') {
|
|
77
|
-
call.reject(errorUtils.jsonToError(content));
|
|
78
|
-
} else {
|
|
79
|
-
call.resolve(content);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
this.responseQueue.delete(idx);
|
|
83
|
-
|
|
84
|
-
// Process the next call
|
|
85
|
-
this.processQueue();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Keep in mind to make sure responses to these calls are JSON.Stringify safe
|
|
89
|
-
async addCall(request, awaitResponse = true) {
|
|
90
|
-
let call = request;
|
|
91
|
-
call.type = 'request';
|
|
92
|
-
call.child = this.childId;
|
|
93
|
-
call.awaitResponse = awaitResponse;
|
|
94
|
-
|
|
95
|
-
let promise;
|
|
96
|
-
if (awaitResponse) {
|
|
97
|
-
promise = new Promise((resolve, reject) => {
|
|
98
|
-
call.resolve = resolve;
|
|
99
|
-
call.reject = reject;
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
this.callQueue.push(call);
|
|
104
|
-
this.processQueue();
|
|
105
|
-
|
|
106
|
-
return promise;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
async sendRequest(call) {
|
|
110
|
-
let idx;
|
|
111
|
-
if (call.awaitResponse) {
|
|
112
|
-
idx = this.responseId++;
|
|
113
|
-
this.responseQueue.set(idx, call);
|
|
114
|
-
}
|
|
115
|
-
this.send({
|
|
116
|
-
idx: idx,
|
|
117
|
-
child: call.child,
|
|
118
|
-
type: call.type,
|
|
119
|
-
location: call.location,
|
|
120
|
-
method: call.method,
|
|
121
|
-
args: call.args,
|
|
122
|
-
awaitResponse: call.awaitResponse
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
async processQueue() {
|
|
127
|
-
if (!this.callQueue.length) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (this.responseQueue.size < this.maxConcurrentCalls) {
|
|
132
|
-
this.sendRequest(this.callQueue.shift());
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
end() {
|
|
137
|
-
process.exit();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
let child = new Child();
|
|
142
|
-
process.on('message', child.messageListener.bind(child));
|
|
143
|
-
|
|
144
|
-
module.exports = child;
|
|
Binary file
|