piral-cli 1.8.0-beta.7667 → 1.8.0-beta.7721
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/lib/apps/debug-pilet.js.map +1 -1
- package/lib/apps/publish-piral.js.map +1 -1
- package/lib/apps/upgrade-pilet.js.map +1 -1
- package/lib/build/bundler-calls.js +1 -1
- package/lib/build/bundler-calls.js.map +1 -1
- package/lib/common/archive.js +1 -1
- package/lib/common/archive.js.map +1 -1
- package/lib/common/browser.js +36 -2
- package/lib/common/browser.js.map +1 -1
- package/lib/common/emulator.js.map +1 -1
- package/lib/common/http.js +2 -2
- package/lib/common/http.js.map +1 -1
- package/lib/common/interactive.js +2 -2
- package/lib/common/interactive.js.map +1 -1
- package/lib/common/io.d.ts +2 -2
- package/lib/common/io.js +1 -5
- package/lib/common/io.js.map +1 -1
- package/lib/common/log.js.map +1 -1
- package/lib/common/watcher.js +1 -1
- package/lib/common/watcher.js.map +1 -1
- package/lib/common/website.js +2 -2
- package/lib/common/website.js.map +1 -1
- package/lib/external/index.js +57970 -61424
- package/lib/injectors/pilet-injector.js +2 -2
- package/lib/injectors/pilet-injector.js.map +1 -1
- package/lib/npm-clients/bun.js +4 -1
- package/lib/npm-clients/bun.js.map +1 -1
- package/lib/npm-clients/npm.js.map +1 -1
- package/lib/platforms/web.js +2 -2
- package/lib/platforms/web.js.map +1 -1
- package/lib/questionnaire.js.map +1 -1
- package/package.json +26 -29
- package/src/apps/add-piral-instance-pilet.ts +1 -1
- package/src/apps/build-pilet.ts +2 -2
- package/src/apps/build-piral.ts +2 -2
- package/src/apps/debug-pilet.ts +6 -9
- package/src/apps/debug-piral.ts +3 -3
- package/src/apps/declaration-pilet.ts +2 -2
- package/src/apps/new-pilet.ts +3 -3
- package/src/apps/new-piral.ts +2 -2
- package/src/apps/publish-pilet.ts +1 -1
- package/src/apps/publish-piral.ts +23 -3
- package/src/apps/remove-piral-instance-pilet.ts +2 -2
- package/src/apps/upgrade-pilet.ts +4 -10
- package/src/apps/upgrade-piral.ts +2 -2
- package/src/apps/validate-pilet.ts +2 -2
- package/src/apps/validate-piral.ts +2 -2
- package/src/build/bundler-calls.ts +1 -1
- package/src/common/archive.test.ts +2 -2
- package/src/common/archive.ts +1 -1
- package/src/common/browser.ts +2 -1
- package/src/common/emulator.ts +5 -1
- package/src/common/http.test.ts +55 -57
- package/src/common/http.ts +2 -2
- package/src/common/interactive.ts +2 -2
- package/src/common/io.ts +2 -3
- package/src/common/log.ts +1 -1
- package/src/common/npm.test.ts +6 -2
- package/src/common/parallel.test.ts +9 -3
- package/src/common/watcher.ts +1 -1
- package/src/common/website.ts +8 -3
- package/src/external/index.test.ts +1 -6
- package/src/external/index.ts +26 -12
- package/src/injectors/pilet-injector.ts +2 -2
- package/src/messages.ts +2 -2
- package/src/npm-clients/bun.ts +4 -1
- package/src/npm-clients/npm.ts +1 -1
- package/src/platforms/web.ts +4 -4
- package/src/questionnaire.ts +2 -3
- package/src/rules/pilet-has-externals-as-peers.test.ts +8 -6
- package/src/types/public.ts +1 -3
|
@@ -34,7 +34,7 @@ interface ExtractOptions {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
vitest.mock('path', async () => {
|
|
37
|
-
const original = await vitest.importActual('path') as any;
|
|
37
|
+
const original = (await vitest.importActual('path')) as any;
|
|
38
38
|
|
|
39
39
|
return {
|
|
40
40
|
...original,
|
|
@@ -99,7 +99,7 @@ vitest.mock('../external', () => ({
|
|
|
99
99
|
},
|
|
100
100
|
} as any;
|
|
101
101
|
},
|
|
102
|
-
}
|
|
102
|
+
},
|
|
103
103
|
}));
|
|
104
104
|
|
|
105
105
|
describe('Archive Module', () => {
|
package/src/common/archive.ts
CHANGED
|
@@ -60,7 +60,7 @@ export function unpackTarball(sourceDir: string, sourceFile: string) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export function unpackGzTar(stream: NodeJS.ReadableStream): Promise<PackageFiles> {
|
|
63
|
-
const TarParser = tar.
|
|
63
|
+
const TarParser = tar.Parser;
|
|
64
64
|
|
|
65
65
|
return new Promise((resolve, reject) => {
|
|
66
66
|
const files: PackageFiles = {};
|
package/src/common/browser.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { log } from './log';
|
|
2
2
|
import { config } from './config';
|
|
3
|
-
import { open } from '../external';
|
|
4
3
|
|
|
5
4
|
export async function openBrowserAt(address: string) {
|
|
6
5
|
try {
|
|
6
|
+
const name = 'open';
|
|
7
|
+
const open = await import(name).then((c) => c.default);
|
|
7
8
|
await open(address, undefined);
|
|
8
9
|
} catch (err) {
|
|
9
10
|
log('failedToOpenBrowser_0170', err);
|
package/src/common/emulator.ts
CHANGED
|
@@ -60,7 +60,11 @@ async function makeExternals(sourceDir: string, piralPkg: any, externals: Array<
|
|
|
60
60
|
return [externalDependencies, importmapEntries, optionalDependencies] as const;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
async function createScaffoldingTarballs(
|
|
63
|
+
async function createScaffoldingTarballs(
|
|
64
|
+
sourceDir: string,
|
|
65
|
+
targetDir: string,
|
|
66
|
+
files: Array<string | TemplateFileLocation> = [],
|
|
67
|
+
) {
|
|
64
68
|
const filesDir = resolve(targetDir, filesTar);
|
|
65
69
|
const filesOnceDir = resolve(targetDir, filesOnceTar);
|
|
66
70
|
|
package/src/common/http.test.ts
CHANGED
|
@@ -20,64 +20,62 @@ vitest.mock('../external', async () => {
|
|
|
20
20
|
};
|
|
21
21
|
},
|
|
22
22
|
axios: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const auth = options.headers.authorization === 'Basic 123';
|
|
23
|
+
post(url, _, options) {
|
|
24
|
+
const found = url === apiUrl;
|
|
25
|
+
const auth = options.headers.authorization === 'Basic 123';
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
},
|
|
27
|
+
if (errorRequest) {
|
|
28
|
+
return Promise.reject({
|
|
29
|
+
request: {},
|
|
30
|
+
});
|
|
31
|
+
} else if (errorOther) {
|
|
32
|
+
return Promise.reject({
|
|
33
|
+
message: 'error',
|
|
34
|
+
});
|
|
35
|
+
} else if (errorResponse) {
|
|
36
|
+
return Promise.reject({
|
|
37
|
+
response: {
|
|
38
|
+
status: 410,
|
|
39
|
+
statusText: 'Not Gone',
|
|
40
|
+
data: '{ "message": "This component is not available anymore." }',
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
} else if (errorResponse2) {
|
|
44
|
+
return Promise.reject({
|
|
45
|
+
response: {
|
|
46
|
+
status: 410,
|
|
47
|
+
statusText: 'Not Gone',
|
|
48
|
+
data: { message: 'This component is not available anymore.' },
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
} else if (!found) {
|
|
52
|
+
return Promise.reject({
|
|
53
|
+
response: {
|
|
54
|
+
status: 404,
|
|
55
|
+
statusText: 'Not found',
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
} else if (!auth) {
|
|
59
|
+
return Promise.reject({
|
|
60
|
+
response: {
|
|
61
|
+
status: 401,
|
|
62
|
+
statusText: 'Not authorized',
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
return Promise.resolve({
|
|
67
|
+
status: 200,
|
|
68
|
+
statusText: 'OK',
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
get(url, options) {
|
|
73
|
+
if (errorOther) {
|
|
74
|
+
return Promise.reject({
|
|
75
|
+
message: 'error',
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return Promise.resolve({ data: 'test' });
|
|
81
79
|
},
|
|
82
80
|
},
|
|
83
81
|
FormData: ((await vitest.importActual('form-data')) as any).default,
|
package/src/common/http.ts
CHANGED
|
@@ -122,7 +122,7 @@ export function getAgent({ allowSelfSigned, ca }: AgentOptions) {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
export function downloadFile(target: string, httpsAgent: Agent): Promise<Array<string>> {
|
|
125
|
-
return axios
|
|
125
|
+
return axios
|
|
126
126
|
.get<Stream>(target, {
|
|
127
127
|
responseType: 'stream',
|
|
128
128
|
headers: standardHeaders,
|
|
@@ -239,7 +239,7 @@ export async function postForm(
|
|
|
239
239
|
};
|
|
240
240
|
|
|
241
241
|
try {
|
|
242
|
-
const res = await axios.
|
|
242
|
+
const res = await axios.post(target, form, {
|
|
243
243
|
headers,
|
|
244
244
|
httpsAgent,
|
|
245
245
|
maxContentLength: Infinity,
|
|
@@ -38,7 +38,7 @@ export function getTokenInteractively(url: string, httpsAgent: Agent): TokenResu
|
|
|
38
38
|
if (!(url in tokenRetrievers)) {
|
|
39
39
|
const logResume = logSuspend();
|
|
40
40
|
|
|
41
|
-
tokenRetrievers[url] = axios
|
|
41
|
+
tokenRetrievers[url] = axios
|
|
42
42
|
.post(
|
|
43
43
|
url,
|
|
44
44
|
{
|
|
@@ -69,7 +69,7 @@ export function getTokenInteractively(url: string, httpsAgent: Agent): TokenResu
|
|
|
69
69
|
|
|
70
70
|
try {
|
|
71
71
|
while (true) {
|
|
72
|
-
const { data, status } = await axios.
|
|
72
|
+
const { data, status } = await axios.get(callbackUrl, { httpsAgent, headers: standardHeaders });
|
|
73
73
|
|
|
74
74
|
if (status === 202) {
|
|
75
75
|
await new Promise((resolve) => setTimeout(resolve, 5000));
|
package/src/common/io.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import rimraf from 'rimraf';
|
|
2
1
|
import { transpileModule, ModuleKind, ModuleResolutionKind, ScriptTarget, JsxEmit, version } from 'typescript';
|
|
3
2
|
import { join, resolve, basename, dirname, extname } from 'path';
|
|
4
3
|
import { exists, lstat, unlink, statSync } from 'fs';
|
|
@@ -10,7 +9,7 @@ import { deepMerge } from './merge';
|
|
|
10
9
|
import { computeHash } from './hash';
|
|
11
10
|
import { ForceOverwrite } from './enums';
|
|
12
11
|
import { promptConfirm } from './interactive';
|
|
13
|
-
import { glob } from '../external';
|
|
12
|
+
import { glob, rimraf } from '../external';
|
|
14
13
|
|
|
15
14
|
function promptOverwrite(file: string) {
|
|
16
15
|
const message = `The file ${file} exists already. Do you want to overwrite it?`;
|
|
@@ -54,7 +53,7 @@ export async function removeAny(target: string) {
|
|
|
54
53
|
|
|
55
54
|
export function removeDirectory(targetDir: string) {
|
|
56
55
|
log('generalDebug_0003', `Removing the directory "${targetDir}" ...`);
|
|
57
|
-
return
|
|
56
|
+
return rimraf(targetDir);
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
export async function createDirectory(targetDir: string) {
|
package/src/common/log.ts
CHANGED
|
@@ -62,7 +62,7 @@ export function logFail(message: string, ...args: Array<string | number | boolea
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export function progress(message: string, ...args: Array<string | number | boolean>) {
|
|
65
|
-
const msg = format(message, ...args)
|
|
65
|
+
const msg = format(message, ...args);
|
|
66
66
|
instance.start(msg);
|
|
67
67
|
currentProgress = msg;
|
|
68
68
|
}
|
package/src/common/npm.test.ts
CHANGED
|
@@ -202,9 +202,13 @@ describe('npm Module', () => {
|
|
|
202
202
|
|
|
203
203
|
it('installs a package using the npm command line tool without a target', async () => {
|
|
204
204
|
wrongCase = false;
|
|
205
|
-
await installNpmPackage({ direct: 'npm' }, 'foo', 'latest').then((result) =>
|
|
205
|
+
await installNpmPackage({ direct: 'npm' }, 'foo', 'latest').then((result) =>
|
|
206
|
+
expect(result).toEqual(jsonValueString),
|
|
207
|
+
);
|
|
206
208
|
wrongCase = true;
|
|
207
|
-
await installNpmPackage({ direct: 'npm' }, 'foo', 'latest').then((result) =>
|
|
209
|
+
await installNpmPackage({ direct: 'npm' }, 'foo', 'latest').then((result) =>
|
|
210
|
+
expect(result).not.toEqual(jsonValueString),
|
|
211
|
+
);
|
|
208
212
|
});
|
|
209
213
|
|
|
210
214
|
it('installs a package using the npm command line tool without a version', async () => {
|
|
@@ -13,17 +13,23 @@ describe('Concurrent Workers', () => {
|
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
it('Can run against less entries than concurrency', async () => {
|
|
16
|
-
const result = await concurrentWorkers(['bar', 'rba', 'abr', 'rab', 'arb', 'bra'], 10, (item) =>
|
|
16
|
+
const result = await concurrentWorkers(['bar', 'rba', 'abr', 'rab', 'arb', 'bra'], 10, (item) =>
|
|
17
|
+
Promise.resolve('foo' + item),
|
|
18
|
+
);
|
|
17
19
|
expect(result).toEqual(['foobar', 'foorba', 'fooabr', 'foorab', 'fooarb', 'foobra']);
|
|
18
20
|
});
|
|
19
21
|
|
|
20
22
|
it('Can run against more entries than concurrency', async () => {
|
|
21
|
-
const result = await concurrentWorkers(['bar', 'rba', 'abr', 'rab', 'arb', 'bra'], 2, (item) =>
|
|
23
|
+
const result = await concurrentWorkers(['bar', 'rba', 'abr', 'rab', 'arb', 'bra'], 2, (item) =>
|
|
24
|
+
Promise.resolve('foo' + item),
|
|
25
|
+
);
|
|
22
26
|
expect(result).toEqual(['foobar', 'foorba', 'fooabr', 'foorab', 'fooarb', 'foobra']);
|
|
23
27
|
});
|
|
24
28
|
|
|
25
29
|
it('Can run against equal entries than concurrency', async () => {
|
|
26
|
-
const result = await concurrentWorkers(['bar', 'rba', 'abr', 'rab', 'arb', 'bra'], 6, (item) =>
|
|
30
|
+
const result = await concurrentWorkers(['bar', 'rba', 'abr', 'rab', 'arb', 'bra'], 6, (item) =>
|
|
31
|
+
Promise.resolve('foo' + item),
|
|
32
|
+
);
|
|
27
33
|
expect(result).toEqual(['foobar', 'foorba', 'fooabr', 'foorab', 'fooarb', 'foobra']);
|
|
28
34
|
});
|
|
29
35
|
});
|
package/src/common/watcher.ts
CHANGED
|
@@ -22,7 +22,7 @@ export function watcherTask<T = void>(cb: (watcherContext: WatcherContext) => Pr
|
|
|
22
22
|
|
|
23
23
|
const disposers: Array<() => void | Promise<void>> = [];
|
|
24
24
|
const triggers: Array<() => void> = [];
|
|
25
|
-
const end = new Promise<void>(resolve => {
|
|
25
|
+
const end = new Promise<void>((resolve) => {
|
|
26
26
|
notify = resolve;
|
|
27
27
|
});
|
|
28
28
|
const ref: WatcherRef<T> = {
|
package/src/common/website.ts
CHANGED
|
@@ -15,7 +15,7 @@ async function requestManifest(url: string, httpsAgent: Agent, interactive: bool
|
|
|
15
15
|
const opts = getAxiosOptions(url);
|
|
16
16
|
|
|
17
17
|
try {
|
|
18
|
-
return await axios.
|
|
18
|
+
return await axios.get(url, { ...opts, httpsAgent });
|
|
19
19
|
} catch (error) {
|
|
20
20
|
return await handleAxiosError(error, interactive, httpsAgent, async (mode, key) => {
|
|
21
21
|
const headers = getAuthorizationHeaders(mode, key);
|
|
@@ -51,7 +51,7 @@ async function downloadEmulatorFiles(
|
|
|
51
51
|
.filter((file) => file && typeof file === 'string')
|
|
52
52
|
.map(async (file) => {
|
|
53
53
|
const url = new URL(file, manifestUrl);
|
|
54
|
-
const res = await axios.
|
|
54
|
+
const res = await axios.get(url.href, opts);
|
|
55
55
|
const data: Buffer = res.data;
|
|
56
56
|
await writeBinary(target, file, data);
|
|
57
57
|
});
|
|
@@ -106,7 +106,12 @@ async function createEmulatorFiles(
|
|
|
106
106
|
await downloadEmulatorFiles(manifestUrl, targetDir, appDir, emulatorJson.files, httpsAgent);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
export async function updateFromEmulatorWebsite(
|
|
109
|
+
export async function updateFromEmulatorWebsite(
|
|
110
|
+
targetDir: string,
|
|
111
|
+
manifestUrl: string,
|
|
112
|
+
httpsAgent: Agent,
|
|
113
|
+
interactive: boolean,
|
|
114
|
+
) {
|
|
110
115
|
progress(`Updating emulator from %s ...`, manifestUrl);
|
|
111
116
|
|
|
112
117
|
try {
|
|
@@ -8,7 +8,7 @@ describe('Externals module', () => {
|
|
|
8
8
|
});
|
|
9
9
|
|
|
10
10
|
it('exports axios as a function', () => {
|
|
11
|
-
const axios = externals.axios
|
|
11
|
+
const axios = externals.axios;
|
|
12
12
|
expect(typeof axios).toBe('function');
|
|
13
13
|
});
|
|
14
14
|
|
|
@@ -46,9 +46,4 @@ describe('Externals module', () => {
|
|
|
46
46
|
const tar = externals.tar;
|
|
47
47
|
expect(tar).not.toBeUndefined();
|
|
48
48
|
});
|
|
49
|
-
|
|
50
|
-
it('exports the open module', () => {
|
|
51
|
-
const open = externals.open;
|
|
52
|
-
expect(open).not.toBeUndefined();
|
|
53
|
-
});
|
|
54
49
|
});
|
package/src/external/index.ts
CHANGED
|
@@ -1,17 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import glob
|
|
4
|
-
import
|
|
5
|
-
import FormData = require('form-data');
|
|
1
|
+
import * as jju from 'jju';
|
|
2
|
+
import * as tar from 'tar';
|
|
3
|
+
import glob from 'glob';
|
|
4
|
+
import FormData from 'form-data';
|
|
6
5
|
import rc = require('rc');
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import open = require('open');
|
|
11
|
-
import chalk = require('chalk');
|
|
12
|
-
|
|
6
|
+
import mime from 'mime';
|
|
7
|
+
import axios from 'axios';
|
|
8
|
+
import inquirer from 'inquirer';
|
|
13
9
|
import isInteractive from 'is-interactive';
|
|
10
|
+
import getPort from 'get-port';
|
|
14
11
|
import ora from 'ora';
|
|
12
|
+
import chalk from 'chalk';
|
|
13
|
+
import { rimraf } from 'rimraf';
|
|
15
14
|
import { getModulePath } from './resolve';
|
|
16
15
|
|
|
17
|
-
export {
|
|
16
|
+
export {
|
|
17
|
+
chalk,
|
|
18
|
+
inquirer,
|
|
19
|
+
isInteractive,
|
|
20
|
+
ora,
|
|
21
|
+
glob,
|
|
22
|
+
tar,
|
|
23
|
+
rimraf,
|
|
24
|
+
FormData,
|
|
25
|
+
rc,
|
|
26
|
+
axios,
|
|
27
|
+
mime,
|
|
28
|
+
getPort,
|
|
29
|
+
jju,
|
|
30
|
+
getModulePath,
|
|
31
|
+
};
|
|
@@ -110,7 +110,7 @@ type FeedResponse = { items?: Array<PiletMetadata> } | Array<PiletMetadata> | Pi
|
|
|
110
110
|
|
|
111
111
|
async function loadFeed(feed: string, headers: any) {
|
|
112
112
|
try {
|
|
113
|
-
const response = await axios.
|
|
113
|
+
const response = await axios.get<FeedResponse>(feed, { headers });
|
|
114
114
|
|
|
115
115
|
if (Array.isArray(response.data)) {
|
|
116
116
|
return response.data;
|
|
@@ -394,7 +394,7 @@ export default class PiletInjector implements KrasInjector {
|
|
|
394
394
|
const manifestUrl = this.proxyInfo.source;
|
|
395
395
|
const url = new URL(path, manifestUrl);
|
|
396
396
|
const opts = getAxiosOptions(manifestUrl);
|
|
397
|
-
return axios.
|
|
397
|
+
return axios.get(url.href, { ...opts, responseType: 'arraybuffer' });
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
private async shouldLoad(target: string, path: string) {
|
package/src/messages.ts
CHANGED
|
@@ -2630,7 +2630,7 @@ export function requiredEmulatorAssetDownloadSkipped_0123(url: string): QuickMes
|
|
|
2630
2630
|
* Only an emulator website can be published using `piral publish`. Other artifacts such as
|
|
2631
2631
|
* standard release artifacts or the package emulator (tgz) need to be published using other
|
|
2632
2632
|
* mechanisms such as `npm publish`.
|
|
2633
|
-
*
|
|
2633
|
+
*
|
|
2634
2634
|
* If no emulator website exists you can either build one using the `--fresh` flag with
|
|
2635
2635
|
* `piral publish` (i.e., `piral publish --fresh`) or preparing the build using `piral build`
|
|
2636
2636
|
* with the `--type emulator-website` flag.
|
|
@@ -2699,7 +2699,7 @@ export function failedToOpenBrowser_0170(error: string): QuickMessage {
|
|
|
2699
2699
|
* The v2 version uses a SystemJS format for the pilet. It has the broadest browser support
|
|
2700
2700
|
* but requires the custom format as output. Most bundlers support SystemJS directly or
|
|
2701
2701
|
* indirectly, making it a quite broad choice.
|
|
2702
|
-
*
|
|
2702
|
+
*
|
|
2703
2703
|
* In bundlers that support Module Federation (e.g., Webpack 5) the "mf" format may be
|
|
2704
2704
|
* the best choice. Keep in mind that "mf" is only supported by applications using
|
|
2705
2705
|
* Piral 1.4.0 or higher.
|
package/src/npm-clients/bun.ts
CHANGED
|
@@ -81,5 +81,8 @@ export async function listProjects(target: string) {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
log('generalDebug_0003', `Bun workspaces result: ${ms.value}`);
|
|
84
|
-
return ms.value
|
|
84
|
+
return ms.value
|
|
85
|
+
.split('\n')
|
|
86
|
+
.filter((m) => m.startsWith('├──'))
|
|
87
|
+
.map((m) => m.replace('├── ', ''));
|
|
85
88
|
}
|
package/src/npm-clients/npm.ts
CHANGED
|
@@ -41,7 +41,7 @@ export async function detectClient(root: string, stopDir = resolve(root, '/')) {
|
|
|
41
41
|
|
|
42
42
|
export async function isProject(root: string, packageRef: string) {
|
|
43
43
|
const details = await listPackage(packageRef, root);
|
|
44
|
-
const packageDetails =
|
|
44
|
+
const packageDetails = details?.dependencies?.[packageRef];
|
|
45
45
|
|
|
46
46
|
if (packageDetails && typeof packageDetails.resolved === 'string') {
|
|
47
47
|
return packageDetails.resolved.startsWith('file:');
|
package/src/platforms/web.ts
CHANGED
|
@@ -63,7 +63,7 @@ async function startModule(options: PlatformStartModuleOptions) {
|
|
|
63
63
|
configs.unshift(resolve(dirname(appPackageJson), krasrc));
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
configs.push(resolve(process.cwd(), krasrc));
|
|
68
68
|
|
|
69
69
|
if (customkrasrc) {
|
|
@@ -93,7 +93,7 @@ async function startModule(options: PlatformStartModuleOptions) {
|
|
|
93
93
|
|
|
94
94
|
registerEnd(() => krasServer.stop());
|
|
95
95
|
return (options: any) => {
|
|
96
|
-
const injector = krasServer.injectors.find(m => m.name === 'pilet-injector');
|
|
96
|
+
const injector = krasServer.injectors.find((m) => m.name === 'pilet-injector');
|
|
97
97
|
injector?.setOptions(options);
|
|
98
98
|
};
|
|
99
99
|
}
|
|
@@ -136,7 +136,7 @@ async function startShell(options: PlatformStartShellOptions) {
|
|
|
136
136
|
},
|
|
137
137
|
},
|
|
138
138
|
};
|
|
139
|
-
|
|
139
|
+
|
|
140
140
|
configs.push(resolve(process.cwd(), krasrc));
|
|
141
141
|
|
|
142
142
|
if (customkrasrc) {
|
|
@@ -165,7 +165,7 @@ async function startShell(options: PlatformStartShellOptions) {
|
|
|
165
165
|
|
|
166
166
|
registerEnd(async () => krasServer.stop());
|
|
167
167
|
return (options: any) => {
|
|
168
|
-
const injector = krasServer.injectors.find(m => m.name === 'piral-injector');
|
|
168
|
+
const injector = krasServer.injectors.find((m) => m.name === 'piral-injector');
|
|
169
169
|
injector?.setOptions(options);
|
|
170
170
|
};
|
|
171
171
|
}
|
package/src/questionnaire.ts
CHANGED
|
@@ -149,14 +149,13 @@ export function runQuestionnaireFor(
|
|
|
149
149
|
name: instruction.name,
|
|
150
150
|
default: instruction.values ? instruction.values.indexOf(instruction.default) : instruction.default,
|
|
151
151
|
message: instruction.describe,
|
|
152
|
-
type: getType(instruction),
|
|
152
|
+
type: getType(instruction) as 'list' | 'input' | 'confirm',
|
|
153
153
|
choices: instruction.values,
|
|
154
154
|
validate: instruction.type === 'number' ? (input: string) => !isNaN(+input) : () => true,
|
|
155
155
|
}));
|
|
156
156
|
|
|
157
|
-
|
|
158
157
|
return inquirer.prompt(questions).then((answers) => {
|
|
159
|
-
const parameters: any = {};
|
|
158
|
+
const parameters: Record<string, any> = {};
|
|
160
159
|
|
|
161
160
|
for (const instruction of instructions) {
|
|
162
161
|
const name = instruction.name;
|
|
@@ -18,7 +18,7 @@ const usedExternalsToFail = usedExternalPrefixesToFail
|
|
|
18
18
|
.reduce((acc, val) => acc.concat(val), []);
|
|
19
19
|
|
|
20
20
|
vitest.mock('../common', async () => ({
|
|
21
|
-
...(await vitest.importActual('../common') as any),
|
|
21
|
+
...((await vitest.importActual('../common')) as any),
|
|
22
22
|
getSourceFiles() {
|
|
23
23
|
return usedExternalPrefixes.map((prefix) => ({
|
|
24
24
|
read() {
|
|
@@ -39,13 +39,15 @@ describe('Rule pilet-has-externals-as-peers', () => {
|
|
|
39
39
|
|
|
40
40
|
function createContext(externals: string[]): PiletRuleContext {
|
|
41
41
|
return {
|
|
42
|
-
apps: [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
apps: [
|
|
43
|
+
{
|
|
44
|
+
appPackage: {
|
|
45
|
+
pilets: {
|
|
46
|
+
externals,
|
|
47
|
+
},
|
|
46
48
|
},
|
|
47
49
|
},
|
|
48
|
-
|
|
50
|
+
],
|
|
49
51
|
piletPackage: {},
|
|
50
52
|
peerDependencies,
|
|
51
53
|
peerModules,
|
package/src/types/public.ts
CHANGED
|
@@ -253,9 +253,7 @@ export type PiralBuildType =
|
|
|
253
253
|
| 'emulator-sources'
|
|
254
254
|
| 'emulator-website';
|
|
255
255
|
|
|
256
|
-
export type PiralPublishType =
|
|
257
|
-
| 'release'
|
|
258
|
-
| 'emulator';
|
|
256
|
+
export type PiralPublishType = 'release' | 'emulator';
|
|
259
257
|
|
|
260
258
|
export type PiletBuildType = 'default' | 'standalone' | 'manifest';
|
|
261
259
|
|