piral-cli 0.15.0-alpha.4041 → 0.15.0-alpha.4098
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/build-pilet.js.map +1 -1
- package/lib/apps/build-piral.js.map +1 -1
- package/lib/apps/debug-pilet.js.map +1 -1
- package/lib/apps/debug-piral.js.map +1 -1
- package/lib/apps/index.js +5 -1
- package/lib/apps/index.js.map +1 -1
- package/lib/build/bundler-calls.d.ts +1 -1
- package/lib/build/run-build-pilet.js.map +1 -1
- package/lib/build/run-build-piral.js.map +1 -1
- package/lib/build/run-debug-mono-piral.js +1 -1
- package/lib/build/run-debug-mono-piral.js.map +1 -1
- package/lib/build/run-debug-pilet.js.map +1 -1
- package/lib/build/run-debug-piral.js.map +1 -1
- package/lib/common/clients/npm.js +10 -4
- package/lib/common/clients/npm.js.map +1 -1
- package/lib/common/clients/pnpm.js +10 -4
- package/lib/common/clients/pnpm.js.map +1 -1
- package/lib/common/clients/yarn.js +10 -4
- package/lib/common/clients/yarn.js.map +1 -1
- package/lib/common/config.js.map +1 -1
- package/lib/common/importmap.js +3 -2
- package/lib/common/importmap.js.map +1 -1
- package/lib/common/index.js +5 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/scaffold.js.map +1 -1
- package/lib/external/index.js +482 -462
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/injectors/pilet.d.ts +1 -0
- package/lib/injectors/pilet.js +5 -5
- package/lib/injectors/pilet.js.map +1 -1
- package/lib/types/index.js +5 -1
- package/lib/types/index.js.map +1 -1
- package/package.json +2 -2
- package/src/build/bundler-calls.ts +1 -1
- package/src/build/run-build-pilet.ts +1 -1
- package/src/build/run-build-piral.ts +1 -1
- package/src/build/run-debug-mono-piral.ts +2 -2
- package/src/build/run-debug-pilet.ts +1 -1
- package/src/build/run-debug-piral.ts +1 -1
- package/src/common/clients/npm.ts +12 -4
- package/src/common/clients/pnpm.ts +12 -4
- package/src/common/clients/yarn.ts +12 -4
- package/src/common/config.ts +3 -3
- package/src/common/importmap.ts +4 -2
- package/src/common/scaffold.ts +1 -0
- package/src/injectors/pilet.ts +6 -5
package/lib/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,kDAAgC;AAChC,iDAA+B;AAC/B,iDAA+B"}
|
package/lib/injectors/pilet.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ interface PiletMetadata {
|
|
|
22
22
|
export default class PiletInjector implements KrasInjector {
|
|
23
23
|
config: PiletInjectorConfig;
|
|
24
24
|
private piletApi;
|
|
25
|
+
private indexPath;
|
|
25
26
|
constructor(options: PiletInjectorConfig, config: KrasConfiguration, core: EventEmitter);
|
|
26
27
|
get active(): boolean;
|
|
27
28
|
set active(value: boolean);
|
package/lib/injectors/pilet.js
CHANGED
|
@@ -17,7 +17,6 @@ const spec_1 = require("../common/spec");
|
|
|
17
17
|
const config_1 = require("../common/config");
|
|
18
18
|
const external_1 = require("../external");
|
|
19
19
|
const { host } = config_1.config;
|
|
20
|
-
const indexPath = '/index.html';
|
|
21
20
|
function fillPiletMeta(pilet, basePath, metaFile) {
|
|
22
21
|
const { root, bundler } = pilet;
|
|
23
22
|
const metaPath = (0, path_1.join)(root, metaFile);
|
|
@@ -58,7 +57,8 @@ class PiletInjector {
|
|
|
58
57
|
this.piletApi = /^https?:/.test(options.api)
|
|
59
58
|
? options.api
|
|
60
59
|
: `${config.ssl ? 'https' : 'http'}://${host}:${config.port}${options.api}`;
|
|
61
|
-
const { pilets, api } = options;
|
|
60
|
+
const { pilets, api, publicUrl } = options;
|
|
61
|
+
this.indexPath = `${publicUrl}index.html`;
|
|
62
62
|
const cbs = {};
|
|
63
63
|
core.on('user-connected', (e) => {
|
|
64
64
|
if (e.target === '*' && e.url === api.substring(1)) {
|
|
@@ -175,15 +175,15 @@ class PiletInjector {
|
|
|
175
175
|
const path = req.url.substring(publicUrl.length).split('?')[0];
|
|
176
176
|
const target = (0, path_1.join)(app, path);
|
|
177
177
|
if ((0, fs_1.existsSync)(target) && (0, fs_1.statSync)(target).isFile()) {
|
|
178
|
-
if (req.url === indexPath) {
|
|
178
|
+
if (req.url === this.indexPath) {
|
|
179
179
|
return this.sendIndexFile(target, req.url);
|
|
180
180
|
}
|
|
181
181
|
else {
|
|
182
182
|
return this.sendFile(target, req.url);
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
else if (req.url !== indexPath) {
|
|
186
|
-
return this.handle(Object.assign(Object.assign({}, req), { url: indexPath }));
|
|
185
|
+
else if (req.url !== this.indexPath) {
|
|
186
|
+
return this.handle(Object.assign(Object.assign({}, req), { url: this.indexPath }));
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pilet.js","sourceRoot":"","sources":["../../src/injectors/pilet.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA0B;AAC1B,+BA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,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAChD,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;SACzC;IACH,CAAC;CACF;AAxKD,gCAwKC"}
|
package/lib/types/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,6CAA2B;AAC3B,2CAAyB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-cli",
|
|
3
|
-
"version": "0.15.0-alpha.
|
|
3
|
+
"version": "0.15.0-alpha.4098",
|
|
4
4
|
"description": "The standard CLI for creating and building a Piral instance or a Pilet.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"portal",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"typescript": "^4.0.2",
|
|
79
79
|
"yargs": "^15.4.1"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "02ef35574b29cc5dd93c515bfdf27dd523893b28"
|
|
82
82
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolve } from 'path';
|
|
2
2
|
import { fork, ChildProcess } from 'child_process';
|
|
3
|
-
import { Bundler, BundleDetails, BaseBundleParameters } from '../types';
|
|
3
|
+
import type { Bundler, BundleDetails, BaseBundleParameters } from '../types';
|
|
4
4
|
|
|
5
5
|
function getPath(name: string) {
|
|
6
6
|
return resolve(__dirname, '..', '..', 'lib', 'build', `run-${name}.js`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PiletSchemaVersion, LogLevels, SharedDependency, PiletBuildHandler } from '../types';
|
|
2
1
|
import { setStandardEnvs } from '../common';
|
|
2
|
+
import type { PiletSchemaVersion, LogLevels, SharedDependency, PiletBuildHandler } from '../types';
|
|
3
3
|
|
|
4
4
|
let handler: PiletBuildHandler;
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { LogLevels, PiralBuildHandler } from '../types';
|
|
2
|
-
import { setStandardEnvs, progress, logReset } from '../common';
|
|
3
1
|
import { resolve } from 'path';
|
|
2
|
+
import { setStandardEnvs, progress, logReset } from '../common';
|
|
3
|
+
import type { LogLevels, PiralBuildHandler } from '../types';
|
|
4
4
|
|
|
5
5
|
let handler: PiralBuildHandler;
|
|
6
6
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setStandardEnvs } from '../common';
|
|
1
2
|
import type {
|
|
2
3
|
PiletSchemaVersion,
|
|
3
4
|
LogLevels,
|
|
@@ -5,7 +6,6 @@ import type {
|
|
|
5
6
|
BundleHandlerResponse,
|
|
6
7
|
PiletBuildHandler,
|
|
7
8
|
} from '../types';
|
|
8
|
-
import { setStandardEnvs } from '../common';
|
|
9
9
|
|
|
10
10
|
let handler: PiletBuildHandler;
|
|
11
11
|
let bundler: BundleHandlerResponse;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BundleHandlerResponse, LogLevels, PiralBuildHandler } from '../types';
|
|
2
1
|
import { setStandardEnvs } from '../common';
|
|
2
|
+
import type { BundleHandlerResponse, LogLevels, PiralBuildHandler } from '../types';
|
|
3
3
|
|
|
4
4
|
let handler: PiralBuildHandler;
|
|
5
5
|
let bundler: BundleHandlerResponse;
|
|
@@ -24,10 +24,18 @@ export async function unpackPackage(packageRef: string, target = '.', ...flags:
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export async function installPackage(packageRef: string, target = '.', ...flags: Array<string>) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
try {
|
|
28
|
+
const ms = new MemoryStream();
|
|
29
|
+
await runNpmProcess(['install', packageRef, '--legacy-peer-deps', ...flags], target, ms);
|
|
30
|
+
log('generalDebug_0003', `npm install package result: ${ms.value}`);
|
|
31
|
+
return ms.value;
|
|
32
|
+
} catch (ex) {
|
|
33
|
+
log(
|
|
34
|
+
'generalError_0002',
|
|
35
|
+
`Could not install the package "${packageRef}" using npm. Make sure npm is correctly installed and accessible: ${ex}`,
|
|
36
|
+
);
|
|
37
|
+
throw ex;
|
|
38
|
+
}
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
export async function createPackage(target = '.', ...flags: Array<string>) {
|
|
@@ -29,8 +29,16 @@ export async function installDependencies(target = '.', ...flags: Array<string>)
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export async function installPackage(packageRef: string, target = '.', ...flags: Array<string>) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
try {
|
|
33
|
+
const ms = new MemoryStream();
|
|
34
|
+
await runPnpmProcess(['add', packageRef, ...convert(flags)], target, ms);
|
|
35
|
+
log('generalDebug_0003', `Pnpm install package result: ${ms.value}`);
|
|
36
|
+
return ms.value;
|
|
37
|
+
} catch (ex) {
|
|
38
|
+
log(
|
|
39
|
+
'generalError_0002',
|
|
40
|
+
`Could not install the package "${packageRef}" using Pnpm. Make sure Pnpm is correctly installed and accessible: ${ex}`,
|
|
41
|
+
);
|
|
42
|
+
throw ex;
|
|
43
|
+
}
|
|
36
44
|
}
|
|
@@ -33,8 +33,16 @@ export async function installDependencies(target = '.', ...flags: Array<string>)
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export async function installPackage(packageRef: string, target = '.', ...flags: Array<string>) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
try {
|
|
37
|
+
const ms = new MemoryStream();
|
|
38
|
+
await runYarnProcess(['add', packageRef, ...convert(flags)], target, ms);
|
|
39
|
+
log('generalDebug_0003', `Yarn install package result: ${ms.value}`);
|
|
40
|
+
return ms.value;
|
|
41
|
+
} catch (ex) {
|
|
42
|
+
log(
|
|
43
|
+
'generalError_0002',
|
|
44
|
+
`Could not install the package "${packageRef}" using Yarn. Make sure Yarn@1 is correctly installed and accessible: ${ex}`,
|
|
45
|
+
);
|
|
46
|
+
throw ex;
|
|
47
|
+
}
|
|
40
48
|
}
|
package/src/common/config.ts
CHANGED
|
@@ -72,11 +72,11 @@ export const config: PiralCliConfig = rc(
|
|
|
72
72
|
apiKeys: {},
|
|
73
73
|
url: undefined,
|
|
74
74
|
cert: undefined,
|
|
75
|
-
npmClient: 'npm',
|
|
76
|
-
bundler: 'webpack5',
|
|
75
|
+
npmClient: 'npm' as const,
|
|
76
|
+
bundler: 'webpack5' as const,
|
|
77
77
|
piletApi: '/$pilet-api',
|
|
78
78
|
validators: {},
|
|
79
|
-
schemaVersion: 'v2',
|
|
79
|
+
schemaVersion: 'v2' as const,
|
|
80
80
|
openBrowser: false,
|
|
81
81
|
port: 1234,
|
|
82
82
|
language: SourceLanguage.ts,
|
package/src/common/importmap.ts
CHANGED
|
@@ -10,6 +10,8 @@ interface Importmap {
|
|
|
10
10
|
inherit: Array<string>;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
const shorthandsUrls = ['', '.', '...'];
|
|
14
|
+
|
|
13
15
|
function tryResolve(baseDir: string, name: string) {
|
|
14
16
|
try {
|
|
15
17
|
return require.resolve(name, {
|
|
@@ -74,7 +76,7 @@ async function resolveImportmap(dir: string, importmap: Importmap) {
|
|
|
74
76
|
ref: url,
|
|
75
77
|
type: 'remote',
|
|
76
78
|
});
|
|
77
|
-
} else if (url === identifier) {
|
|
79
|
+
} else if (url === identifier || shorthandsUrls.includes(url)) {
|
|
78
80
|
const entry = tryResolve(dir, identifier);
|
|
79
81
|
|
|
80
82
|
if (entry) {
|
|
@@ -90,7 +92,7 @@ async function resolveImportmap(dir: string, importmap: Importmap) {
|
|
|
90
92
|
type: 'local',
|
|
91
93
|
});
|
|
92
94
|
} else {
|
|
93
|
-
fail('importMapReferenceNotFound_0027', dir,
|
|
95
|
+
fail('importMapReferenceNotFound_0027', dir, identifier);
|
|
94
96
|
}
|
|
95
97
|
} else {
|
|
96
98
|
const entry = resolve(dir, url);
|
package/src/common/scaffold.ts
CHANGED
package/src/injectors/pilet.ts
CHANGED
|
@@ -10,7 +10,6 @@ import { axios, mime } from '../external';
|
|
|
10
10
|
import { Bundler } from '../types';
|
|
11
11
|
|
|
12
12
|
const { host } = config;
|
|
13
|
-
const indexPath = '/index.html';
|
|
14
13
|
|
|
15
14
|
interface Pilet {
|
|
16
15
|
bundler: Bundler;
|
|
@@ -76,6 +75,7 @@ async function loadFeed(feed: string) {
|
|
|
76
75
|
export default class PiletInjector implements KrasInjector {
|
|
77
76
|
public config: PiletInjectorConfig;
|
|
78
77
|
private piletApi: string;
|
|
78
|
+
private indexPath: string;
|
|
79
79
|
|
|
80
80
|
constructor(options: PiletInjectorConfig, config: KrasConfiguration, core: EventEmitter) {
|
|
81
81
|
this.config = options;
|
|
@@ -84,7 +84,8 @@ export default class PiletInjector implements KrasInjector {
|
|
|
84
84
|
? options.api
|
|
85
85
|
: `${config.ssl ? 'https' : 'http'}://${host}:${config.port}${options.api}`;
|
|
86
86
|
|
|
87
|
-
const { pilets, api } = options;
|
|
87
|
+
const { pilets, api, publicUrl } = options;
|
|
88
|
+
this.indexPath = `${publicUrl}index.html`;
|
|
88
89
|
const cbs = {};
|
|
89
90
|
|
|
90
91
|
core.on('user-connected', (e) => {
|
|
@@ -220,15 +221,15 @@ export default class PiletInjector implements KrasInjector {
|
|
|
220
221
|
const target = join(app, path);
|
|
221
222
|
|
|
222
223
|
if (existsSync(target) && statSync(target).isFile()) {
|
|
223
|
-
if (req.url === indexPath) {
|
|
224
|
+
if (req.url === this.indexPath) {
|
|
224
225
|
return this.sendIndexFile(target, req.url);
|
|
225
226
|
} else {
|
|
226
227
|
return this.sendFile(target, req.url);
|
|
227
228
|
}
|
|
228
|
-
} else if (req.url !== indexPath) {
|
|
229
|
+
} else if (req.url !== this.indexPath) {
|
|
229
230
|
return this.handle({
|
|
230
231
|
...req,
|
|
231
|
-
url: indexPath,
|
|
232
|
+
url: this.indexPath,
|
|
232
233
|
});
|
|
233
234
|
}
|
|
234
235
|
}
|