@bonsae/nrg 0.16.0 → 0.18.0
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/README.md +112 -19
- package/package.json +38 -6
- package/server/index.cjs +38 -24
- package/server/resources/nrg-client.js +3667 -3521
- package/test/client/component/index.js +244 -0
- package/test/client/component/setup.js +201 -0
- package/test/client/e2e/index.js +2698 -0
- package/test/client/unit/index.js +200 -0
- package/test/client/unit/setup.js +199 -0
- package/test/{index.js → server/unit/index.js} +23 -8
- package/tsconfig/core/client.json +11 -0
- package/tsconfig/{server.json → core/server.json} +1 -1
- package/tsconfig/test/client/component.json +11 -0
- package/tsconfig/test/client/e2e.json +6 -0
- package/tsconfig/test/client/unit.json +6 -0
- package/tsconfig/test/server/unit.json +6 -0
- package/types/client.d.ts +66 -0
- package/types/server.d.ts +74 -58
- package/types/shims/form/components/node-red-config-input.vue.d.ts +15 -2
- package/types/shims/form/components/node-red-editor-input.vue.d.ts +18 -3
- package/types/shims/form/components/node-red-input.vue.d.ts +17 -5
- package/types/shims/form/components/node-red-json-schema-form.vue.d.ts +117 -19
- package/types/shims/form/components/node-red-select-input.vue.d.ts +15 -1
- package/types/shims/form/components/node-red-typed-input.vue.d.ts +52 -8
- package/types/test-client-component.d.ts +70 -0
- package/types/test-client-e2e.d.ts +152 -0
- package/types/test-client-unit.d.ts +52 -0
- package/types/{test.d.ts → test-server-unit.d.ts} +12 -2
- package/vite/index.js +15 -7
- package/tsconfig/client.json +0 -11
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
modelValue: {
|
|
3
|
+
type: PropType<{
|
|
4
|
+
value: string;
|
|
5
|
+
type: string;
|
|
6
|
+
} | undefined>;
|
|
7
|
+
default: undefined;
|
|
8
|
+
validator: (obj: {
|
|
9
|
+
value: string;
|
|
10
|
+
type: string;
|
|
11
|
+
} | undefined) => boolean;
|
|
12
|
+
};
|
|
2
13
|
value: {
|
|
3
|
-
type:
|
|
4
|
-
|
|
14
|
+
type: PropType<{
|
|
15
|
+
value: string;
|
|
16
|
+
type: string;
|
|
17
|
+
} | undefined>;
|
|
18
|
+
default: undefined;
|
|
5
19
|
validator: (obj: {
|
|
6
20
|
value: string;
|
|
7
21
|
type: string;
|
|
8
|
-
}) => boolean;
|
|
22
|
+
} | undefined) => boolean;
|
|
9
23
|
};
|
|
10
24
|
types: {
|
|
11
25
|
type: PropType<(NodeRED.DefaultTypedInputType | NodeRED.TypedInputTypeDefinition)[]>;
|
|
@@ -27,18 +41,39 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
27
41
|
type: StringConstructor;
|
|
28
42
|
default: string;
|
|
29
43
|
};
|
|
30
|
-
}>, {
|
|
44
|
+
}>, {
|
|
45
|
+
inputWidget: import("vue").ShallowRef<any, any>;
|
|
46
|
+
mutationObserver: import("vue").ShallowRef<MutationObserver | null, MutationObserver | null>;
|
|
47
|
+
}, {}, {
|
|
48
|
+
effectiveValue(): {
|
|
49
|
+
value: string;
|
|
50
|
+
type: string;
|
|
51
|
+
};
|
|
31
52
|
isProvidedValueTypeValid(): boolean;
|
|
32
53
|
}, {
|
|
33
54
|
onChange(): void;
|
|
34
|
-
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
55
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:value")[], "update:modelValue" | "update:value", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
56
|
+
modelValue: {
|
|
57
|
+
type: PropType<{
|
|
58
|
+
value: string;
|
|
59
|
+
type: string;
|
|
60
|
+
} | undefined>;
|
|
61
|
+
default: undefined;
|
|
62
|
+
validator: (obj: {
|
|
63
|
+
value: string;
|
|
64
|
+
type: string;
|
|
65
|
+
} | undefined) => boolean;
|
|
66
|
+
};
|
|
35
67
|
value: {
|
|
36
|
-
type:
|
|
37
|
-
|
|
68
|
+
type: PropType<{
|
|
69
|
+
value: string;
|
|
70
|
+
type: string;
|
|
71
|
+
} | undefined>;
|
|
72
|
+
default: undefined;
|
|
38
73
|
validator: (obj: {
|
|
39
74
|
value: string;
|
|
40
75
|
type: string;
|
|
41
|
-
}) => boolean;
|
|
76
|
+
} | undefined) => boolean;
|
|
42
77
|
};
|
|
43
78
|
types: {
|
|
44
79
|
type: PropType<(NodeRED.DefaultTypedInputType | NodeRED.TypedInputTypeDefinition)[]>;
|
|
@@ -61,11 +96,20 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
61
96
|
default: string;
|
|
62
97
|
};
|
|
63
98
|
}>> & Readonly<{
|
|
99
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
64
100
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
65
101
|
}>, {
|
|
66
102
|
label: string;
|
|
67
103
|
icon: string;
|
|
68
104
|
required: boolean;
|
|
105
|
+
modelValue: {
|
|
106
|
+
value: string;
|
|
107
|
+
type: string;
|
|
108
|
+
} | undefined;
|
|
109
|
+
value: {
|
|
110
|
+
value: string;
|
|
111
|
+
type: string;
|
|
112
|
+
} | undefined;
|
|
69
113
|
error: string;
|
|
70
114
|
types: ("msg" | "flow" | "global" | "str" | "num" | "bool" | "json" | "bin" | "re" | "jsonata" | "date" | "env" | "node" | "cred" | NodeRED.TypedInputTypeDefinition)[];
|
|
71
115
|
}, {}, {
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
export interface MockEditor {
|
|
4
|
+
getValue(): string;
|
|
5
|
+
setValue(val: string): void;
|
|
6
|
+
getSession(): {
|
|
7
|
+
on(event: string, cb: (...args: any[]) => any): void;
|
|
8
|
+
};
|
|
9
|
+
focus(): void;
|
|
10
|
+
destroy(): void;
|
|
11
|
+
saveView(): void;
|
|
12
|
+
restoreView(): void;
|
|
13
|
+
}
|
|
14
|
+
export interface MockRED {
|
|
15
|
+
_(key: string): string;
|
|
16
|
+
editor: {
|
|
17
|
+
createEditor(options: any): MockEditor;
|
|
18
|
+
prepareConfigNodeSelect(...args: any[]): void;
|
|
19
|
+
validateNode(...args: any[]): boolean;
|
|
20
|
+
};
|
|
21
|
+
tray: {
|
|
22
|
+
show(...args: any[]): void;
|
|
23
|
+
close(): void;
|
|
24
|
+
};
|
|
25
|
+
popover: {
|
|
26
|
+
tooltip(...args: any[]): {
|
|
27
|
+
delete(): void;
|
|
28
|
+
setAction(...args: any[]): void;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
nodes: {
|
|
32
|
+
registerType(...args: any[]): void;
|
|
33
|
+
node(...args: any[]): null;
|
|
34
|
+
dirty(...args: any[]): boolean;
|
|
35
|
+
};
|
|
36
|
+
events: {
|
|
37
|
+
on(...args: any[]): void;
|
|
38
|
+
off(...args: any[]): void;
|
|
39
|
+
emit(...args: any[]): void;
|
|
40
|
+
};
|
|
41
|
+
settings: Record<string, any>;
|
|
42
|
+
notify(...args: any[]): void;
|
|
43
|
+
}
|
|
44
|
+
export declare function createRED(): MockRED;
|
|
45
|
+
export declare function createJQuery(): (selector: any, attrs?: Record<string, any>) => any;
|
|
46
|
+
export declare const defaultConfig: {
|
|
47
|
+
testTimeout: number;
|
|
48
|
+
setupFiles: string[];
|
|
49
|
+
browser: {
|
|
50
|
+
enabled: boolean;
|
|
51
|
+
instances: {
|
|
52
|
+
browser: string;
|
|
53
|
+
}[];
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export interface TestNode {
|
|
57
|
+
id: string;
|
|
58
|
+
type: string;
|
|
59
|
+
changed: boolean;
|
|
60
|
+
_def: Record<string, any>;
|
|
61
|
+
_: (key: string) => string;
|
|
62
|
+
[key: string]: any;
|
|
63
|
+
}
|
|
64
|
+
interface CreateNodeResult {
|
|
65
|
+
node: TestNode;
|
|
66
|
+
RED: MockRED;
|
|
67
|
+
}
|
|
68
|
+
export declare function createNode(overrides?: Record<string, any>): CreateNodeResult;
|
|
69
|
+
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
import { Locator, Page } from 'playwright';
|
|
4
|
+
|
|
5
|
+
interface ClientBuildOptions {
|
|
6
|
+
/** Source directory for client code. @default "./src/client" */
|
|
7
|
+
srcDir?: string;
|
|
8
|
+
/** Entry filename relative to srcDir. @default "index.ts" */
|
|
9
|
+
entry?: string;
|
|
10
|
+
/** Subdirectory name for node definition files. @default "nodes" */
|
|
11
|
+
nodesSubdir?: string;
|
|
12
|
+
/** Pattern to match node definition files. */
|
|
13
|
+
nodeFilePattern?: RegExp;
|
|
14
|
+
/** Global variable name for the UMD/IIFE bundle. @default "NodeRedNodes" */
|
|
15
|
+
name?: string;
|
|
16
|
+
/** Output format for the client bundle. @default "es" */
|
|
17
|
+
format?: "es" | "iife" | "umd";
|
|
18
|
+
/** Base public path for serving resources. */
|
|
19
|
+
base?: string;
|
|
20
|
+
/** Path to LICENSE file to include in the HTML output. @default "./LICENSE" */
|
|
21
|
+
licensePath?: string;
|
|
22
|
+
/** Internationalization options for labels and docs. */
|
|
23
|
+
locales?: LocalesOptions;
|
|
24
|
+
/** Directories for static assets (icons, public files). */
|
|
25
|
+
staticDirs?: {
|
|
26
|
+
/** Directory containing node icons ({type}.png). @default "./src/icons" */
|
|
27
|
+
icons?: string;
|
|
28
|
+
/** Directory for public static files copied to dist/resources/. @default "./src/client/public" */
|
|
29
|
+
public?: string;
|
|
30
|
+
};
|
|
31
|
+
/** Modules to treat as external (not bundled). @default ["jquery", "node-red", "vue", "@bonsae/nrg/client"] */
|
|
32
|
+
external?: string[];
|
|
33
|
+
/** Global variable mappings for external modules. */
|
|
34
|
+
globals?: Record<string, string>;
|
|
35
|
+
/** Custom chunk splitting function for Rollup. */
|
|
36
|
+
manualChunks?: (id: string) => string | undefined;
|
|
37
|
+
}
|
|
38
|
+
interface LocalesOptions {
|
|
39
|
+
/** Directory containing documentation files ({type}/{lang}.md or .html). @default "./src/locales/docs" */
|
|
40
|
+
docsDir?: string;
|
|
41
|
+
/** Directory containing label files ({type}/{lang}.json). @default "./src/locales/labels" */
|
|
42
|
+
labelsDir?: string;
|
|
43
|
+
}
|
|
44
|
+
interface ServerBuildOptions {
|
|
45
|
+
/** Source directory for server code. @default "./src/server" */
|
|
46
|
+
srcDir?: string;
|
|
47
|
+
/** Entry filename relative to srcDir. @default "index.ts" */
|
|
48
|
+
entry?: string;
|
|
49
|
+
/** Output format. "esm" builds to .mjs with a CJS bridge for Node-RED. @default "esm" */
|
|
50
|
+
format?: "cjs" | "esm";
|
|
51
|
+
/** Packages to keep as external (not bundled). @default [] */
|
|
52
|
+
external?: string[];
|
|
53
|
+
/** Dependencies to bundle into the output instead of keeping as external. @default [] */
|
|
54
|
+
bundled?: string[];
|
|
55
|
+
/** Generate rolled-up .d.ts type declarations (production only). @default true */
|
|
56
|
+
types?: boolean;
|
|
57
|
+
/** esbuild target for the server bundle. @default "node22" */
|
|
58
|
+
nodeTarget?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface NodeRedTestEnvironmentOptions {
|
|
61
|
+
projectDir?: string;
|
|
62
|
+
packageName: string;
|
|
63
|
+
clientName?: string;
|
|
64
|
+
port?: number;
|
|
65
|
+
settingsFile?: string;
|
|
66
|
+
server?: Partial<ServerBuildOptions>;
|
|
67
|
+
client?: Partial<ClientBuildOptions>;
|
|
68
|
+
}
|
|
69
|
+
export declare class NodeRedTestEnvironment {
|
|
70
|
+
private port;
|
|
71
|
+
private launcher;
|
|
72
|
+
private originalCwd;
|
|
73
|
+
private readonly projectDir;
|
|
74
|
+
private readonly outDir;
|
|
75
|
+
private readonly nodeRedDir;
|
|
76
|
+
private readonly installedPkgDir;
|
|
77
|
+
private readonly options;
|
|
78
|
+
constructor(options: NodeRedTestEnvironmentOptions);
|
|
79
|
+
get nodeRedPort(): number | null;
|
|
80
|
+
setup(): Promise<number>;
|
|
81
|
+
deployFlow(flow: Record<string, unknown>[]): Promise<void>;
|
|
82
|
+
teardown(): Promise<void>;
|
|
83
|
+
}
|
|
84
|
+
export interface SetupOptions {
|
|
85
|
+
settingsFile?: string;
|
|
86
|
+
flow?: Record<string, unknown>[];
|
|
87
|
+
}
|
|
88
|
+
export declare const defaultConfig: {
|
|
89
|
+
testTimeout: number;
|
|
90
|
+
hookTimeout: number;
|
|
91
|
+
globalSetup: string[];
|
|
92
|
+
};
|
|
93
|
+
export declare function setup(options?: SetupOptions): Promise<void>;
|
|
94
|
+
export declare function teardown(): Promise<void>;
|
|
95
|
+
export declare class NodeRedEditor {
|
|
96
|
+
readonly page: Page;
|
|
97
|
+
readonly port: number;
|
|
98
|
+
readonly errors: string[];
|
|
99
|
+
private screenshotDir;
|
|
100
|
+
constructor(page: Page, port: number, options?: {
|
|
101
|
+
screenshotDir?: string;
|
|
102
|
+
});
|
|
103
|
+
screenshot(name: string): Promise<string>;
|
|
104
|
+
open(): Promise<void>;
|
|
105
|
+
deployFlow(flow: Record<string, unknown>[]): Promise<void>;
|
|
106
|
+
editNode(nodeId: string): Promise<void>;
|
|
107
|
+
clickDone(): Promise<void>;
|
|
108
|
+
clickCancel(): Promise<void>;
|
|
109
|
+
field(label: string): NodeRedField;
|
|
110
|
+
expectNoPageErrors(): void;
|
|
111
|
+
get tray(): Locator;
|
|
112
|
+
}
|
|
113
|
+
export declare class NodeRedField {
|
|
114
|
+
private readonly page;
|
|
115
|
+
readonly label: string;
|
|
116
|
+
readonly row: Locator;
|
|
117
|
+
constructor(page: Page, label: string);
|
|
118
|
+
get input(): Locator;
|
|
119
|
+
fill(value: string): Promise<void>;
|
|
120
|
+
clear(): Promise<void>;
|
|
121
|
+
getValue(): Promise<string>;
|
|
122
|
+
getInputType(): Promise<string | null>;
|
|
123
|
+
get toggleSlider(): Locator;
|
|
124
|
+
toggle(): Promise<void>;
|
|
125
|
+
get checkbox(): Locator;
|
|
126
|
+
get typedInputContainer(): Locator;
|
|
127
|
+
getSelectedType(): Promise<string>;
|
|
128
|
+
getSelectedValue(): Promise<string>;
|
|
129
|
+
openTypeMenu(): Promise<Locator>;
|
|
130
|
+
getTypeMenuValues(): Promise<string[]>;
|
|
131
|
+
selectType(type: string): Promise<void>;
|
|
132
|
+
openOptionMenu(): Promise<Locator>;
|
|
133
|
+
getOptionMenuLabels(): Promise<string[]>;
|
|
134
|
+
get select(): Locator;
|
|
135
|
+
get editButton(): Locator;
|
|
136
|
+
get addButton(): Locator;
|
|
137
|
+
getSelectedOption(): Promise<string>;
|
|
138
|
+
getSelectedOptionLabel(): Promise<string>;
|
|
139
|
+
getOptions(): Promise<string[]>;
|
|
140
|
+
get editorWrapper(): Locator;
|
|
141
|
+
get expandButton(): Locator;
|
|
142
|
+
get textarea(): Locator;
|
|
143
|
+
get requiredIndicator(): Locator;
|
|
144
|
+
get errorMessage(): Locator;
|
|
145
|
+
expectError(containing?: string): Promise<void>;
|
|
146
|
+
expectNoError(): Promise<void>;
|
|
147
|
+
scrollIntoView(): Promise<void>;
|
|
148
|
+
expectVisible(): Promise<void>;
|
|
149
|
+
expectHidden(): Promise<void>;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
export interface MockEditor {
|
|
4
|
+
getValue(): string;
|
|
5
|
+
setValue(val: string): void;
|
|
6
|
+
getSession(): {
|
|
7
|
+
on(event: string, cb: (...args: any[]) => any): void;
|
|
8
|
+
};
|
|
9
|
+
focus(): void;
|
|
10
|
+
destroy(): void;
|
|
11
|
+
saveView(): void;
|
|
12
|
+
restoreView(): void;
|
|
13
|
+
}
|
|
14
|
+
export interface MockRED {
|
|
15
|
+
_(key: string): string;
|
|
16
|
+
editor: {
|
|
17
|
+
createEditor(options: any): MockEditor;
|
|
18
|
+
prepareConfigNodeSelect(...args: any[]): void;
|
|
19
|
+
validateNode(...args: any[]): boolean;
|
|
20
|
+
};
|
|
21
|
+
tray: {
|
|
22
|
+
show(...args: any[]): void;
|
|
23
|
+
close(): void;
|
|
24
|
+
};
|
|
25
|
+
popover: {
|
|
26
|
+
tooltip(...args: any[]): {
|
|
27
|
+
delete(): void;
|
|
28
|
+
setAction(...args: any[]): void;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
nodes: {
|
|
32
|
+
registerType(...args: any[]): void;
|
|
33
|
+
node(...args: any[]): null;
|
|
34
|
+
dirty(...args: any[]): boolean;
|
|
35
|
+
};
|
|
36
|
+
events: {
|
|
37
|
+
on(...args: any[]): void;
|
|
38
|
+
off(...args: any[]): void;
|
|
39
|
+
emit(...args: any[]): void;
|
|
40
|
+
};
|
|
41
|
+
settings: Record<string, any>;
|
|
42
|
+
notify(...args: any[]): void;
|
|
43
|
+
}
|
|
44
|
+
export declare function createRED(): MockRED;
|
|
45
|
+
export declare function createJQuery(): (selector: any, attrs?: Record<string, any>) => any;
|
|
46
|
+
export declare const defaultConfig: {
|
|
47
|
+
testTimeout: number;
|
|
48
|
+
environment: "happy-dom";
|
|
49
|
+
setupFiles: string[];
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export {};
|
|
@@ -196,13 +196,13 @@ interface NodeRedRuntimeSettings {
|
|
|
196
196
|
apiMaxLength?: string;
|
|
197
197
|
[key: string]: unknown;
|
|
198
198
|
}
|
|
199
|
-
type Schema<T extends TProperties = TProperties> = TObject<T>;
|
|
200
199
|
declare const NodeConfigSchema: import("@sinclair/typebox").TObject<{
|
|
201
200
|
id: import("@sinclair/typebox").TString;
|
|
202
201
|
type: import("@sinclair/typebox").TString;
|
|
203
202
|
name: import("@sinclair/typebox").TString;
|
|
204
203
|
z: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
205
204
|
}>;
|
|
205
|
+
type Schema<T extends TProperties = TProperties> = TObject<T>;
|
|
206
206
|
interface NodeConstructor<T = any, TConfig = any, TCredentials = any> {
|
|
207
207
|
readonly type: string;
|
|
208
208
|
readonly category: string;
|
|
@@ -371,10 +371,13 @@ interface NodeRedContextStore {
|
|
|
371
371
|
set(key: string, value: any, store: string | undefined, callback: (err: Error | null) => void): void;
|
|
372
372
|
keys(store: string | undefined, callback: (err: Error | null, keys: string[]) => void): void;
|
|
373
373
|
}
|
|
374
|
-
interface MockRED extends RED {
|
|
374
|
+
export interface MockRED extends RED {
|
|
375
375
|
registerNode(id: string, nodeRedNode: Partial<NodeRedNode>): void;
|
|
376
376
|
registerNrgNode(id: string, nrgInstance: Partial<INode>): void;
|
|
377
377
|
}
|
|
378
|
+
export declare function createRED(options?: {
|
|
379
|
+
settings?: Record<string, any>;
|
|
380
|
+
}): MockRED;
|
|
378
381
|
interface CreateNodeOptions {
|
|
379
382
|
config?: Record<string, any>;
|
|
380
383
|
credentials?: Record<string, any>;
|
|
@@ -387,11 +390,18 @@ type ExtractInput<T> = T extends {
|
|
|
387
390
|
type ExtractOutput<T> = T extends {
|
|
388
391
|
send(msg: infer O): any;
|
|
389
392
|
} ? O : any;
|
|
393
|
+
type PortNames<T> = [
|
|
394
|
+
T
|
|
395
|
+
] extends [
|
|
396
|
+
Record<string, Record<string, any>>
|
|
397
|
+
] ? string extends keyof T ? never : keyof T & string : never;
|
|
398
|
+
type PortMessage<T, P extends string> = T extends Record<string, any> ? (P extends keyof T ? T[P] : never) : never;
|
|
390
399
|
interface TestNodeHelpers<TInput = any, TOutput = any> {
|
|
391
400
|
receive(msg: TInput): Promise<void>;
|
|
392
401
|
close(removed?: boolean): Promise<void>;
|
|
393
402
|
reset(): void;
|
|
394
403
|
sent(): TOutput[];
|
|
404
|
+
sent<P extends PortNames<TOutput>>(port: P): PortMessage<TOutput, P>[];
|
|
395
405
|
sent(port: number): any[];
|
|
396
406
|
statuses(): any[];
|
|
397
407
|
logged(level?: "info" | "warn" | "error" | "debug"): string[];
|
package/vite/index.js
CHANGED
|
@@ -77,8 +77,12 @@ function copyFiles(targets, outDir) {
|
|
|
77
77
|
function getPackageName() {
|
|
78
78
|
const pkgPath = path.resolve("./package.json");
|
|
79
79
|
if (fs.existsSync(pkgPath)) {
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
try {
|
|
81
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
82
|
+
return pkg.name;
|
|
83
|
+
} catch {
|
|
84
|
+
return "node-red-nodes";
|
|
85
|
+
}
|
|
82
86
|
}
|
|
83
87
|
return "node-red-nodes";
|
|
84
88
|
}
|
|
@@ -1220,7 +1224,8 @@ async function build(serverOpts, buildContext) {
|
|
|
1220
1224
|
esbuild: {
|
|
1221
1225
|
platform: "node",
|
|
1222
1226
|
target: nodeTarget,
|
|
1223
|
-
keepNames: true
|
|
1227
|
+
keepNames: true,
|
|
1228
|
+
tsconfigRaw: "{}"
|
|
1224
1229
|
}
|
|
1225
1230
|
};
|
|
1226
1231
|
try {
|
|
@@ -2374,7 +2379,7 @@ async function build2(clientBuildOptions, buildContext) {
|
|
|
2374
2379
|
const config = {
|
|
2375
2380
|
configFile: false,
|
|
2376
2381
|
logLevel: "warn",
|
|
2377
|
-
base:
|
|
2382
|
+
base: `/resources/${buildContext.packageName}`,
|
|
2378
2383
|
publicDir: path11.resolve(srcDir, "public"),
|
|
2379
2384
|
resolve: {
|
|
2380
2385
|
alias: {
|
|
@@ -2382,6 +2387,9 @@ async function build2(clientBuildOptions, buildContext) {
|
|
|
2382
2387
|
}
|
|
2383
2388
|
},
|
|
2384
2389
|
plugins,
|
|
2390
|
+
esbuild: {
|
|
2391
|
+
tsconfigRaw: "{}"
|
|
2392
|
+
},
|
|
2385
2393
|
css: {
|
|
2386
2394
|
devSourcemap: buildContext.isDev
|
|
2387
2395
|
},
|
|
@@ -2401,9 +2409,9 @@ async function build2(clientBuildOptions, buildContext) {
|
|
|
2401
2409
|
external,
|
|
2402
2410
|
treeshake: false,
|
|
2403
2411
|
output: {
|
|
2404
|
-
entryFileNames:
|
|
2405
|
-
chunkFileNames:
|
|
2406
|
-
assetFileNames:
|
|
2412
|
+
entryFileNames: "resources/index.[hash].js",
|
|
2413
|
+
chunkFileNames: "resources/vendor.[hash].js",
|
|
2414
|
+
assetFileNames: "resources/[name].[hash].[ext]",
|
|
2407
2415
|
globals,
|
|
2408
2416
|
paths: {
|
|
2409
2417
|
vue: "/nrg/assets/vue.esm-browser.prod.js",
|
package/tsconfig/client.json
DELETED