piral-cli 0.15.0-beta.4820 → 0.15.0-beta.4830
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 +1 -1
- package/lib/apps/build-pilet.js.map +1 -1
- package/lib/apps/build-piral.js +2 -2
- package/lib/apps/build-piral.js.map +1 -1
- package/lib/apps/debug-pilet.js +1 -1
- package/lib/apps/debug-pilet.js.map +1 -1
- package/lib/apps/debug-piral.js +1 -3
- package/lib/apps/debug-piral.js.map +1 -1
- package/lib/apps/validate-piral.js +2 -1
- package/lib/apps/validate-piral.js.map +1 -1
- package/lib/common/declaration.js +1 -1
- package/lib/common/declaration.js.map +1 -1
- package/lib/common/emulator.d.ts +2 -2
- package/lib/common/emulator.js +6 -4
- package/lib/common/emulator.js.map +1 -1
- package/lib/common/importmap.js +1 -1
- package/lib/common/importmap.js.map +1 -1
- package/lib/common/language.d.ts +4 -0
- package/lib/common/language.js +6 -2
- package/lib/common/language.js.map +1 -1
- package/lib/common/npm.d.ts +2 -2
- package/lib/common/npm.js +3 -3
- package/lib/common/npm.js.map +1 -1
- package/lib/common/package.d.ts +5 -4
- package/lib/common/package.js +24 -7
- package/lib/common/package.js.map +1 -1
- package/lib/rules/pilet-has-externals-as-peers.js +4 -4
- package/lib/rules/pilet-has-externals-as-peers.js.map +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/types/common.d.ts +1 -1
- package/package.json +2 -2
- package/src/apps/build-pilet.ts +1 -1
- package/src/apps/build-piral.ts +2 -2
- package/src/apps/debug-pilet.ts +1 -1
- package/src/apps/debug-piral.ts +1 -1
- package/src/apps/validate-piral.ts +2 -1
- package/src/common/declaration.ts +1 -1
- package/src/common/emulator.ts +9 -7
- package/src/common/importmap.ts +1 -1
- package/src/common/language.ts +9 -1
- package/src/common/npm.ts +4 -5
- package/src/common/package.ts +34 -7
- package/src/rules/pilet-has-externals-as-peers.ts +4 -4
- package/src/rules/piral-has-valid-externals.ts +11 -29
- package/src/types/common.ts +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { findDependencyVersion } from '../common';
|
|
1
2
|
import { PiralRuleContext } from '../types';
|
|
2
3
|
|
|
3
4
|
export type Options = void;
|
|
@@ -6,38 +7,19 @@ export type Options = void;
|
|
|
6
7
|
* Checks that the externals to be used in pilets are valid.
|
|
7
8
|
*/
|
|
8
9
|
export default function (context: PiralRuleContext, options: Options = undefined) {
|
|
9
|
-
const { externals } = context
|
|
10
|
+
const { externals } = context;
|
|
11
|
+
const invalidDepRefs = externals
|
|
12
|
+
.filter((ext) => !ext.parents || ext.parents.length === 0)
|
|
13
|
+
.map((ext) => ext.name)
|
|
14
|
+
.filter((name) => context.dependencies[name] === undefined && context.devDependencies[name] === undefined);
|
|
10
15
|
|
|
11
|
-
|
|
12
|
-
context.
|
|
16
|
+
for (const invalidDepRef of invalidDepRefs) {
|
|
17
|
+
context.warning(
|
|
13
18
|
`
|
|
14
|
-
The shared
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
The shared dependency "${invalidDepRef}" is not listed in the "dependencies" and "devDependencies".
|
|
20
|
+
Expected: "${invalidDepRef}" in dependencies.
|
|
21
|
+
Received: <none>.
|
|
17
22
|
`,
|
|
18
23
|
);
|
|
19
|
-
} else {
|
|
20
|
-
const invalidDepTypes = externals.filter((ext) => typeof ext !== 'string');
|
|
21
|
-
const invalidDepRefs = externals.filter((ext) => typeof ext === 'string' && !context.dependencies[ext]);
|
|
22
|
-
|
|
23
|
-
if (invalidDepTypes.length > 0) {
|
|
24
|
-
context.error(
|
|
25
|
-
`
|
|
26
|
-
The shared dependencies in pilets.external are invalid.
|
|
27
|
-
Expected: Only names (<string>) in the array.
|
|
28
|
-
Received: Found ${invalidDepTypes.length} non-<string> entries.
|
|
29
|
-
`,
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
for (const invalidDepRef of invalidDepRefs) {
|
|
34
|
-
context.warning(
|
|
35
|
-
`
|
|
36
|
-
The shared dependency "${invalidDepRef}" is listed in pilets.external, but not in dependencies.
|
|
37
|
-
Expected: "${invalidDepRef}" in dependencies.
|
|
38
|
-
Received: <none>.
|
|
39
|
-
`,
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
24
|
}
|
|
43
25
|
}
|
package/src/types/common.ts
CHANGED
|
@@ -104,7 +104,6 @@ export interface TemplateFileLocation {
|
|
|
104
104
|
export interface PiletsInfo {
|
|
105
105
|
files: Array<string | TemplateFileLocation>;
|
|
106
106
|
template: string;
|
|
107
|
-
externals?: Array<string>;
|
|
108
107
|
devDependencies: Record<string, string | true>;
|
|
109
108
|
scripts: Record<string, string>;
|
|
110
109
|
validators: Record<string, any>;
|
|
@@ -147,6 +146,7 @@ export interface Rule<T extends RuleContext> {
|
|
|
147
146
|
|
|
148
147
|
export interface PiralRuleContext extends RuleContext {
|
|
149
148
|
info: PiletsInfo;
|
|
149
|
+
externals: Array<SharedDependency>;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
export interface PiletRuleContext extends RuleContext {
|