@quereus/plugin-loader 0.3.3 → 0.4.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/dist/src/config-loader.d.ts +13 -7
- package/dist/src/config-loader.d.ts.map +1 -1
- package/dist/src/config-loader.js +53 -44
- package/dist/src/config-loader.js.map +1 -1
- package/dist/src/manifest.d.ts +7 -69
- package/dist/src/manifest.d.ts.map +1 -1
- package/dist/src/plugin-loader.d.ts.map +1 -1
- package/dist/src/plugin-loader.js +96 -97
- package/dist/src/plugin-loader.js.map +1 -1
- package/package.json +6 -2
|
@@ -8,7 +8,7 @@ import type { Database } from '@quereus/quereus';
|
|
|
8
8
|
*/
|
|
9
9
|
export interface PluginConfig {
|
|
10
10
|
source: string;
|
|
11
|
-
config?: Record<string,
|
|
11
|
+
config?: Record<string, unknown>;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Quoomb configuration file format
|
|
@@ -18,24 +18,30 @@ export interface QuoombConfig {
|
|
|
18
18
|
plugins?: PluginConfig[];
|
|
19
19
|
autoload?: boolean;
|
|
20
20
|
}
|
|
21
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
22
|
+
type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
23
|
+
[key: string]: JsonValue;
|
|
24
|
+
};
|
|
21
25
|
/**
|
|
22
|
-
* Interpolate environment variables in a value
|
|
23
|
-
* Supports ${VAR_NAME} and ${VAR_NAME:-default} syntax
|
|
26
|
+
* Interpolate environment variables in a value.
|
|
27
|
+
* Supports ${VAR_NAME} and ${VAR_NAME:-default} syntax.
|
|
24
28
|
*/
|
|
25
|
-
export declare function interpolateEnvVars(value:
|
|
29
|
+
export declare function interpolateEnvVars(value: JsonValue, env?: Record<string, string>): JsonValue;
|
|
26
30
|
/**
|
|
27
31
|
* Interpolate environment variables in a config object
|
|
28
32
|
*/
|
|
29
33
|
export declare function interpolateConfigEnvVars(config: QuoombConfig, env?: Record<string, string>): QuoombConfig;
|
|
30
34
|
/**
|
|
31
|
-
* Load plugins from a config object
|
|
35
|
+
* Load plugins from a config object.
|
|
36
|
+
* Collects all load failures and throws an aggregate error when any plugins fail.
|
|
32
37
|
*/
|
|
33
38
|
export declare function loadPluginsFromConfig(db: Database, config: QuoombConfig, options?: {
|
|
34
39
|
allowCdn?: boolean;
|
|
35
40
|
env?: 'auto' | 'browser' | 'node';
|
|
36
41
|
}): Promise<void>;
|
|
37
42
|
/**
|
|
38
|
-
* Validate a config object
|
|
43
|
+
* Validate a config object structure
|
|
39
44
|
*/
|
|
40
|
-
export declare function validateConfig(config:
|
|
45
|
+
export declare function validateConfig(config: unknown): config is QuoombConfig;
|
|
46
|
+
export {};
|
|
41
47
|
//# sourceMappingURL=config-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/config-loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/config-loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,kBAAkB,CAAC;AAM3D;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,KAAK,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AACtD,KAAK,SAAS,GAAG,aAAa,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE5E;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAAG,SAAS,CAkBhG;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,YAAY,CAGzG;AAmBD;;;GAGG;AACH,wBAAsB,qBAAqB,CAC1C,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAA;CAAE,GACjE,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,YAAY,CAetE"}
|
|
@@ -3,15 +3,17 @@
|
|
|
3
3
|
* Handles loading, parsing, and interpolating quoomb.config.json files
|
|
4
4
|
*/
|
|
5
5
|
import { loadPlugin } from './plugin-loader.js';
|
|
6
|
+
import debug from 'debug';
|
|
7
|
+
const log = debug('quereus:config-loader');
|
|
6
8
|
/**
|
|
7
|
-
* Interpolate environment variables in a value
|
|
8
|
-
* Supports ${VAR_NAME} and ${VAR_NAME:-default} syntax
|
|
9
|
+
* Interpolate environment variables in a value.
|
|
10
|
+
* Supports ${VAR_NAME} and ${VAR_NAME:-default} syntax.
|
|
9
11
|
*/
|
|
10
12
|
export function interpolateEnvVars(value, env = {}) {
|
|
11
13
|
if (typeof value === 'string') {
|
|
12
|
-
return value.replace(/\$\{([^}]+)\}/g, (
|
|
14
|
+
return value.replace(/\$\{([^}]+)\}/g, (_match, varSpec) => {
|
|
13
15
|
const [varName, defaultValue] = varSpec.split(':-');
|
|
14
|
-
return env[varName.trim()] ?? defaultValue ??
|
|
16
|
+
return env[varName.trim()] ?? defaultValue ?? _match;
|
|
15
17
|
});
|
|
16
18
|
}
|
|
17
19
|
if (typeof value === 'object' && value !== null) {
|
|
@@ -30,73 +32,80 @@ export function interpolateEnvVars(value, env = {}) {
|
|
|
30
32
|
* Interpolate environment variables in a config object
|
|
31
33
|
*/
|
|
32
34
|
export function interpolateConfigEnvVars(config, env) {
|
|
33
|
-
|
|
34
|
-
if (env) {
|
|
35
|
-
envVars = env;
|
|
36
|
-
}
|
|
37
|
-
else if (typeof process !== 'undefined' && process.env) {
|
|
38
|
-
// Filter out undefined values from process.env
|
|
39
|
-
envVars = Object.fromEntries(Object.entries(process.env).filter(([, v]) => v !== undefined));
|
|
40
|
-
}
|
|
35
|
+
const envVars = env ?? buildProcessEnv();
|
|
41
36
|
return interpolateEnvVars(config, envVars);
|
|
42
37
|
}
|
|
38
|
+
function buildProcessEnv() {
|
|
39
|
+
if (typeof process === 'undefined' || !process.env)
|
|
40
|
+
return {};
|
|
41
|
+
return Object.fromEntries(Object.entries(process.env).filter((entry) => entry[1] !== undefined));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Converts a plugin config value to a SqlValue.
|
|
45
|
+
* Complex types are serialized as JSON strings.
|
|
46
|
+
*/
|
|
47
|
+
function toSqlValue(value) {
|
|
48
|
+
if (value === null || value === undefined)
|
|
49
|
+
return null;
|
|
50
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean')
|
|
51
|
+
return value;
|
|
52
|
+
return JSON.stringify(value);
|
|
53
|
+
}
|
|
43
54
|
/**
|
|
44
|
-
* Load plugins from a config object
|
|
55
|
+
* Load plugins from a config object.
|
|
56
|
+
* Collects all load failures and throws an aggregate error when any plugins fail.
|
|
45
57
|
*/
|
|
46
58
|
export async function loadPluginsFromConfig(db, config, options) {
|
|
47
59
|
if (!config.plugins || config.plugins.length === 0) {
|
|
48
60
|
return;
|
|
49
61
|
}
|
|
62
|
+
const failures = [];
|
|
50
63
|
for (const pluginConfig of config.plugins) {
|
|
51
64
|
try {
|
|
52
|
-
const configObj = pluginConfig.config ?? {};
|
|
53
|
-
// Convert config values to SqlValue type
|
|
54
65
|
const sqlConfig = {};
|
|
55
|
-
for (const [key, value] of Object.entries(
|
|
56
|
-
|
|
57
|
-
sqlConfig[key] = null;
|
|
58
|
-
}
|
|
59
|
-
else if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
60
|
-
sqlConfig[key] = value;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
// For complex types, convert to JSON string
|
|
64
|
-
sqlConfig[key] = JSON.stringify(value);
|
|
65
|
-
}
|
|
66
|
+
for (const [key, value] of Object.entries(pluginConfig.config ?? {})) {
|
|
67
|
+
sqlConfig[key] = toSqlValue(value);
|
|
66
68
|
}
|
|
67
69
|
await loadPlugin(pluginConfig.source, db, sqlConfig, options);
|
|
68
70
|
}
|
|
69
71
|
catch (error) {
|
|
70
|
-
|
|
72
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
73
|
+
log('Failed to load plugin from %s: %s', pluginConfig.source, err.message);
|
|
74
|
+
failures.push({ source: pluginConfig.source, error: err });
|
|
71
75
|
}
|
|
72
76
|
}
|
|
77
|
+
if (failures.length > 0) {
|
|
78
|
+
const details = failures.map(f => ` - ${f.source}: ${f.error.message}`).join('\n');
|
|
79
|
+
throw new Error(`Failed to load ${failures.length} plugin(s):\n${details}`);
|
|
80
|
+
}
|
|
73
81
|
}
|
|
74
82
|
/**
|
|
75
|
-
* Validate a config object
|
|
83
|
+
* Validate a config object structure
|
|
76
84
|
*/
|
|
77
85
|
export function validateConfig(config) {
|
|
78
|
-
if (typeof config !== 'object' || config === null)
|
|
86
|
+
if (typeof config !== 'object' || config === null)
|
|
79
87
|
return false;
|
|
80
|
-
|
|
81
|
-
if (
|
|
82
|
-
if (!Array.isArray(
|
|
88
|
+
const obj = config;
|
|
89
|
+
if (obj.plugins !== undefined) {
|
|
90
|
+
if (!Array.isArray(obj.plugins))
|
|
83
91
|
return false;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (typeof plugin !== 'object' || plugin === null) {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
if (typeof plugin.source !== 'string') {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
if (plugin.config !== undefined && typeof plugin.config !== 'object') {
|
|
92
|
+
for (const plugin of obj.plugins) {
|
|
93
|
+
if (!isValidPluginEntry(plugin))
|
|
93
94
|
return false;
|
|
94
|
-
}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
if (
|
|
97
|
+
if (obj.autoload !== undefined && typeof obj.autoload !== 'boolean')
|
|
98
|
+
return false;
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
function isValidPluginEntry(plugin) {
|
|
102
|
+
if (typeof plugin !== 'object' || plugin === null)
|
|
103
|
+
return false;
|
|
104
|
+
const p = plugin;
|
|
105
|
+
if (typeof p.source !== 'string')
|
|
106
|
+
return false;
|
|
107
|
+
if (p.config !== undefined && p.config !== null && (typeof p.config !== 'object' || Array.isArray(p.config)))
|
|
98
108
|
return false;
|
|
99
|
-
}
|
|
100
109
|
return true;
|
|
101
110
|
}
|
|
102
111
|
//# sourceMappingURL=config-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../src/config-loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../src/config-loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,GAAG,GAAG,KAAK,CAAC,uBAAu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AI,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,GAAG,CAAC,QAAQ,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAElF,OAAO,IAAI,CAAC;AACb,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAe;IAC1C,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAChE,MAAM,CAAC,GAAG,MAAiC,CAAC;IAC5C,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC/C,IAAI,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3H,OAAO,IAAI,CAAC;AACb,CAAC"}
|
package/dist/src/manifest.d.ts
CHANGED
|
@@ -1,72 +1,10 @@
|
|
|
1
|
-
import type { SqlValue, FunctionSchema, CollationFunction, TypePluginInfo, VirtualTableModule, VirtualTable } from '@quereus/quereus';
|
|
2
|
-
export type { TypePluginInfo };
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
2
|
+
* Re-export manifest types from the core @quereus/quereus package.
|
|
3
|
+
*
|
|
4
|
+
* All canonical type definitions live in the core package. This module
|
|
5
|
+
* re-exports them so that plugin-loader consumers who import from
|
|
6
|
+
* '@quereus/plugin-loader' continue to resolve the same types without
|
|
7
|
+
* maintaining a duplicate set of definitions.
|
|
5
8
|
*/
|
|
6
|
-
export
|
|
7
|
-
key: string;
|
|
8
|
-
label: string;
|
|
9
|
-
type: 'string' | 'number' | 'boolean' | 'select';
|
|
10
|
-
default?: SqlValue;
|
|
11
|
-
options?: SqlValue[];
|
|
12
|
-
help?: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Virtual table module registration info
|
|
16
|
-
*/
|
|
17
|
-
export interface VTablePluginInfo {
|
|
18
|
-
name: string;
|
|
19
|
-
module: VirtualTableModule<VirtualTable, any>;
|
|
20
|
-
auxData?: unknown;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Function registration info
|
|
24
|
-
*/
|
|
25
|
-
export interface FunctionPluginInfo {
|
|
26
|
-
schema: FunctionSchema;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Collation registration info
|
|
30
|
-
*/
|
|
31
|
-
export interface CollationPluginInfo {
|
|
32
|
-
name: string;
|
|
33
|
-
func: CollationFunction;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Plugin registration items - what the plugin wants to register
|
|
37
|
-
*/
|
|
38
|
-
export interface PluginRegistrations {
|
|
39
|
-
vtables?: VTablePluginInfo[];
|
|
40
|
-
functions?: FunctionPluginInfo[];
|
|
41
|
-
collations?: CollationPluginInfo[];
|
|
42
|
-
types?: TypePluginInfo[];
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Plugin manifest that describes the plugin's metadata and configuration options
|
|
46
|
-
*/
|
|
47
|
-
export interface PluginManifest {
|
|
48
|
-
name: string;
|
|
49
|
-
version: string;
|
|
50
|
-
author?: string;
|
|
51
|
-
description?: string;
|
|
52
|
-
pragmaPrefix?: string;
|
|
53
|
-
settings?: PluginSetting[];
|
|
54
|
-
capabilities?: string[];
|
|
55
|
-
provides?: {
|
|
56
|
-
vtables?: string[];
|
|
57
|
-
functions?: string[];
|
|
58
|
-
collations?: string[];
|
|
59
|
-
types?: string[];
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Plugin record used for persistence across sessions
|
|
64
|
-
*/
|
|
65
|
-
export interface PluginRecord {
|
|
66
|
-
id: string;
|
|
67
|
-
url: string;
|
|
68
|
-
enabled: boolean;
|
|
69
|
-
manifest?: PluginManifest;
|
|
70
|
-
config: Record<string, SqlValue>;
|
|
71
|
-
}
|
|
9
|
+
export type { PluginSetting, VTablePluginInfo, FunctionPluginInfo, CollationPluginInfo, TypePluginInfo, PluginRegistrations, PluginManifest, PluginRecord, } from '@quereus/quereus';
|
|
72
10
|
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/manifest.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,YAAY,EACX,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,YAAY,GACZ,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../src/plugin-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../src/plugin-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAKzE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,wDAAwD;IACxD,OAAO,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,OAAO,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC;CACjH;AA6DD;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACtC,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,QAAQ,EACZ,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAM,GACnC,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAsBrC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAkBtD;AAGD,oCAAoC;AACpC,MAAM,WAAW,iBAAiB;IACjC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sEAAsE;IACtE,GAAG,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;CACtC;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAC/B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,QAAQ,EACZ,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAM,EACrC,OAAO,GAAE,iBAAsB,GAC7B,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CA8BrC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { registerPlugin } from '@quereus/quereus';
|
|
2
|
+
import debug from 'debug';
|
|
3
|
+
const log = debug('quereus:plugin-loader');
|
|
2
4
|
/**
|
|
3
5
|
* Extracts plugin manifest from package.json metadata
|
|
4
|
-
* Looks for metadata in package.json root fields and quereus.provides/settings
|
|
5
6
|
*/
|
|
6
7
|
function extractManifestFromPackageJson(pkg) {
|
|
7
|
-
const quereus = pkg.quereus
|
|
8
|
+
const quereus = pkg.quereus ?? {};
|
|
8
9
|
return {
|
|
9
|
-
name: pkg.name
|
|
10
|
-
version: pkg.version
|
|
10
|
+
name: pkg.name ?? 'Unknown Plugin',
|
|
11
|
+
version: pkg.version ?? '0.0.0',
|
|
11
12
|
author: pkg.author,
|
|
12
13
|
description: pkg.description,
|
|
13
14
|
pragmaPrefix: quereus.pragmaPrefix,
|
|
@@ -16,6 +17,33 @@ function extractManifestFromPackageJson(pkg) {
|
|
|
16
17
|
capabilities: quereus.capabilities
|
|
17
18
|
};
|
|
18
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Validates that a plugin module has the expected structure.
|
|
22
|
+
*/
|
|
23
|
+
function assertValidPluginModule(mod, source) {
|
|
24
|
+
const m = mod;
|
|
25
|
+
if (typeof m.default !== 'function') {
|
|
26
|
+
throw new Error(`Module at ${source} has no default export function`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Attempts to load a package.json manifest from a URL.
|
|
31
|
+
* Returns undefined when the manifest is unavailable.
|
|
32
|
+
*/
|
|
33
|
+
async function tryLoadManifestFromUrl(moduleUrl) {
|
|
34
|
+
try {
|
|
35
|
+
const packageJsonUrl = new URL('package.json', moduleUrl);
|
|
36
|
+
const response = await fetch(packageJsonUrl.toString());
|
|
37
|
+
if (response.ok) {
|
|
38
|
+
const pkg = await response.json();
|
|
39
|
+
return extractManifestFromPackageJson(pkg);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
log('Could not load package.json for plugin at %s', moduleUrl);
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
19
47
|
/**
|
|
20
48
|
* Dynamically loads and registers a plugin module
|
|
21
49
|
*
|
|
@@ -26,36 +54,17 @@ function extractManifestFromPackageJson(pkg) {
|
|
|
26
54
|
*/
|
|
27
55
|
export async function dynamicLoadModule(url, db, config = {}) {
|
|
28
56
|
try {
|
|
29
|
-
// Add cache-busting timestamp for development
|
|
30
57
|
const moduleUrl = new URL(url);
|
|
58
|
+
// Add cache-busting timestamp for local development
|
|
31
59
|
if (moduleUrl.protocol === 'file:' || moduleUrl.hostname === 'localhost') {
|
|
32
60
|
moduleUrl.searchParams.set('t', Date.now().toString());
|
|
33
61
|
}
|
|
34
62
|
// Dynamic import with Vite ignore comment for bundler compatibility
|
|
35
63
|
const mod = await import(/* @vite-ignore */ moduleUrl.toString());
|
|
36
|
-
|
|
37
|
-
if (typeof mod.default !== 'function') {
|
|
38
|
-
throw new Error(`Module at ${url} has no default export function`);
|
|
39
|
-
}
|
|
40
|
-
// Use the core registerPlugin function from @quereus/quereus
|
|
41
|
-
// This reuses the same registration logic as static plugin loading
|
|
64
|
+
assertValidPluginModule(mod, url);
|
|
42
65
|
await registerPlugin(db, mod.default, config);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
let manifest;
|
|
46
|
-
try {
|
|
47
|
-
const packageJsonUrl = new URL('package.json', moduleUrl);
|
|
48
|
-
const packageJsonResponse = await fetch(packageJsonUrl.toString());
|
|
49
|
-
if (packageJsonResponse.ok) {
|
|
50
|
-
const pkg = await packageJsonResponse.json();
|
|
51
|
-
manifest = extractManifestFromPackageJson(pkg);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
// package.json not found or not accessible - that's okay
|
|
56
|
-
console.log(`Could not load package.json for plugin at ${url}`);
|
|
57
|
-
}
|
|
58
|
-
return manifest;
|
|
66
|
+
log('Loaded plugin from %s', url);
|
|
67
|
+
return await tryLoadManifestFromUrl(moduleUrl);
|
|
59
68
|
}
|
|
60
69
|
catch (error) {
|
|
61
70
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -71,7 +80,7 @@ export async function dynamicLoadModule(url, db, config = {}) {
|
|
|
71
80
|
export function validatePluginUrl(url) {
|
|
72
81
|
try {
|
|
73
82
|
const parsed = new URL(url);
|
|
74
|
-
//
|
|
83
|
+
// Only allow secure protocols
|
|
75
84
|
if (!['https:', 'file:'].includes(parsed.protocol)) {
|
|
76
85
|
return false;
|
|
77
86
|
}
|
|
@@ -95,7 +104,7 @@ export function validatePluginUrl(url) {
|
|
|
95
104
|
* - file:///path/to/plugin.js (Node only)
|
|
96
105
|
*/
|
|
97
106
|
export async function loadPlugin(spec, db, config = {}, options = {}) {
|
|
98
|
-
const env = options.env
|
|
107
|
+
const env = resolveEnvironment(options.env);
|
|
99
108
|
// Direct URL or file path via dynamicLoadModule
|
|
100
109
|
if (isUrlLike(spec)) {
|
|
101
110
|
return await dynamicLoadModule(spec, db, config);
|
|
@@ -106,42 +115,7 @@ export async function loadPlugin(spec, db, config = {}, options = {}) {
|
|
|
106
115
|
throw new Error(`Invalid plugin spec: ${spec}. Use a URL, file://, or npm package (e.g., npm:@scope/name@version).`);
|
|
107
116
|
}
|
|
108
117
|
if (env === 'node') {
|
|
109
|
-
|
|
110
|
-
const subpathImport = `${npm.name}/plugin${npm.subpath ?? ''}`;
|
|
111
|
-
const candidates = [subpathImport, `${npm.name}${npm.subpath ?? ''}`];
|
|
112
|
-
let mod;
|
|
113
|
-
let lastErr = undefined;
|
|
114
|
-
for (const target of candidates) {
|
|
115
|
-
try {
|
|
116
|
-
mod = await import(/* @vite-ignore */ target);
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
catch (e) {
|
|
120
|
-
lastErr = e;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
if (!mod) {
|
|
124
|
-
throw new Error(`Failed to resolve plugin package '${npm.name}'. Ensure it exports './plugin' or a default module. Last error: ${lastErr instanceof Error ? lastErr.message : String(lastErr)}`);
|
|
125
|
-
}
|
|
126
|
-
if (typeof mod.default !== 'function') {
|
|
127
|
-
throw new Error(`Resolved module for '${npm.name}' has no default export function`);
|
|
128
|
-
}
|
|
129
|
-
// Use the core registerPlugin function from @quereus/quereus
|
|
130
|
-
await registerPlugin(db, mod.default, config);
|
|
131
|
-
console.log(`Successfully loaded plugin from package ${npm.name}`);
|
|
132
|
-
// Try to extract manifest from package.json
|
|
133
|
-
let manifest;
|
|
134
|
-
try {
|
|
135
|
-
// Try to import package.json directly
|
|
136
|
-
// @vite-ignore - intentional dynamic import for runtime plugin loading
|
|
137
|
-
const pkg = await import(/* @vite-ignore */ `${npm.name}/package.json`, { assert: { type: 'json' } });
|
|
138
|
-
manifest = extractManifestFromPackageJson(pkg.default);
|
|
139
|
-
}
|
|
140
|
-
catch {
|
|
141
|
-
// package.json not found - that's okay
|
|
142
|
-
console.log(`Could not load package.json for plugin ${npm.name}`);
|
|
143
|
-
}
|
|
144
|
-
return manifest;
|
|
118
|
+
return await loadFromNodePackage(npm, db, config);
|
|
145
119
|
}
|
|
146
120
|
// Browser path: npm spec requires CDN; only if explicitly allowed
|
|
147
121
|
if (!options.allowCdn) {
|
|
@@ -151,63 +125,90 @@ export async function loadPlugin(spec, db, config = {}, options = {}) {
|
|
|
151
125
|
const cdnUrl = toCdnUrl(npm, options.cdn ?? 'jsdelivr');
|
|
152
126
|
return await dynamicLoadModule(cdnUrl, db, config);
|
|
153
127
|
}
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
129
|
+
// Internal helpers
|
|
130
|
+
// ---------------------------------------------------------------------------
|
|
131
|
+
function resolveEnvironment(env) {
|
|
132
|
+
if (env && env !== 'auto')
|
|
133
|
+
return env;
|
|
134
|
+
return isBrowserEnv() ? 'browser' : 'node';
|
|
135
|
+
}
|
|
154
136
|
function isBrowserEnv() {
|
|
155
|
-
|
|
156
|
-
|
|
137
|
+
return typeof globalThis !== 'undefined'
|
|
138
|
+
&& typeof globalThis.document !== 'undefined';
|
|
157
139
|
}
|
|
158
140
|
function isUrlLike(s) {
|
|
159
141
|
try {
|
|
160
142
|
const u = new URL(s);
|
|
161
|
-
return u.protocol === 'https:' || u.protocol === '
|
|
143
|
+
return u.protocol === 'https:' || u.protocol === 'file:';
|
|
162
144
|
}
|
|
163
145
|
catch {
|
|
164
146
|
return false;
|
|
165
147
|
}
|
|
166
148
|
}
|
|
167
149
|
function parseNpmSpec(input) {
|
|
168
|
-
// Remove optional npm: prefix
|
|
169
150
|
const raw = input.startsWith('npm:') ? input.slice(4) : input;
|
|
170
|
-
// Quick reject if contains spaces or empty
|
|
171
151
|
if (!raw || /\s/.test(raw))
|
|
172
152
|
return null;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
let subpath;
|
|
153
|
+
const { nameAndVersion, subpath } = splitSubpath(raw);
|
|
154
|
+
return splitVersion(nameAndVersion, subpath);
|
|
155
|
+
}
|
|
156
|
+
function splitSubpath(raw) {
|
|
178
157
|
if (raw.startsWith('@')) {
|
|
179
|
-
// Scoped: look for second '/'
|
|
180
158
|
const secondSlash = raw.indexOf('/', raw.indexOf('/') + 1);
|
|
181
159
|
if (secondSlash !== -1) {
|
|
182
|
-
nameAndVersion
|
|
183
|
-
subpath = raw.slice(secondSlash);
|
|
160
|
+
return { nameAndVersion: raw.slice(0, secondSlash), subpath: raw.slice(secondSlash) };
|
|
184
161
|
}
|
|
185
162
|
}
|
|
186
163
|
else {
|
|
187
164
|
const firstSlash = raw.indexOf('/');
|
|
188
165
|
if (firstSlash !== -1) {
|
|
189
|
-
nameAndVersion
|
|
190
|
-
subpath = raw.slice(firstSlash);
|
|
166
|
+
return { nameAndVersion: raw.slice(0, firstSlash), subpath: raw.slice(firstSlash) };
|
|
191
167
|
}
|
|
192
168
|
}
|
|
193
|
-
|
|
169
|
+
return { nameAndVersion: raw };
|
|
170
|
+
}
|
|
171
|
+
function splitVersion(nameAndVersion, subpath) {
|
|
194
172
|
const atIndex = nameAndVersion.lastIndexOf('@');
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
return { name, version, subpath };
|
|
201
|
-
}
|
|
202
|
-
return { name: nameAndVersion, subpath };
|
|
173
|
+
const startsWithScope = nameAndVersion.startsWith('@');
|
|
174
|
+
if (atIndex > (startsWithScope ? 0 : -1)) {
|
|
175
|
+
const name = nameAndVersion.slice(0, atIndex);
|
|
176
|
+
const version = nameAndVersion.slice(atIndex + 1) || undefined;
|
|
177
|
+
return { name, version, subpath };
|
|
203
178
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
179
|
+
return { name: nameAndVersion, subpath };
|
|
180
|
+
}
|
|
181
|
+
async function loadFromNodePackage(npm, db, config) {
|
|
182
|
+
const subpathImport = `${npm.name}/plugin${npm.subpath ?? ''}`;
|
|
183
|
+
const candidates = [subpathImport, `${npm.name}${npm.subpath ?? ''}`];
|
|
184
|
+
const mod = await resolveFirstModule(candidates, npm.name);
|
|
185
|
+
assertValidPluginModule(mod, npm.name);
|
|
186
|
+
await registerPlugin(db, mod.default, config);
|
|
187
|
+
log('Loaded plugin from package %s', npm.name);
|
|
188
|
+
return await tryLoadManifestFromPackage(npm.name);
|
|
189
|
+
}
|
|
190
|
+
async function resolveFirstModule(candidates, packageName) {
|
|
191
|
+
let lastErr;
|
|
192
|
+
for (const target of candidates) {
|
|
193
|
+
try {
|
|
194
|
+
return await import(/* @vite-ignore */ target);
|
|
209
195
|
}
|
|
210
|
-
|
|
196
|
+
catch (e) {
|
|
197
|
+
lastErr = e;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
throw new Error(`Failed to resolve plugin package '${packageName}'. ` +
|
|
201
|
+
`Ensure it exports './plugin' or a default module. ` +
|
|
202
|
+
`Last error: ${lastErr instanceof Error ? lastErr.message : String(lastErr)}`);
|
|
203
|
+
}
|
|
204
|
+
async function tryLoadManifestFromPackage(packageName) {
|
|
205
|
+
try {
|
|
206
|
+
const pkg = await import(/* @vite-ignore */ `${packageName}/package.json`, { with: { type: 'json' } });
|
|
207
|
+
return extractManifestFromPackageJson(pkg.default);
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
log('Could not load package.json for plugin %s', packageName);
|
|
211
|
+
return undefined;
|
|
211
212
|
}
|
|
212
213
|
}
|
|
213
214
|
function toCdnUrl(spec, cdn) {
|
|
@@ -217,8 +218,6 @@ function toCdnUrl(spec, cdn) {
|
|
|
217
218
|
case 'unpkg':
|
|
218
219
|
return `https://unpkg.com/${spec.name}${versionSegment}/${subpath}`;
|
|
219
220
|
case 'esm.sh':
|
|
220
|
-
// esm.sh expects ?path=/subpath or direct subpath after package
|
|
221
|
-
// Use direct subpath; esm.sh will transform to ESM
|
|
222
221
|
return `https://esm.sh/${spec.name}${versionSegment}/${subpath}`;
|
|
223
222
|
case 'jsdelivr':
|
|
224
223
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-loader.js","sourceRoot":"","sources":["../../src/plugin-loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin-loader.js","sourceRoot":"","sources":["../../src/plugin-loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,GAAG,GAAG,KAAK,CAAC,uBAAuB,CAAC,CAAC;AAuB3C;;GAEG;AACH,SAAS,8BAA8B,CAAC,GAAgB;IACvD,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;IAElC,OAAO;QACN,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,gBAAgB;QAClC,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,OAAO;QAC/B,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,YAAY,EAAE,OAAO,CAAC,YAAY;KAClC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,uBAAuB,CAAC,GAAY,EAAE,MAAc;IAC5D,MAAM,CAAC,GAAG,GAA8B,CAAC;IACzC,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,aAAa,MAAM,iCAAiC,CAAC,CAAC;IACvE,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GAAG,cAAc,IAAI,OAAO,EAAE,CAAC;QACrE,KAAK,QAAQ;YACZ,OAAO,kBAAkB,IAAI,CAAC,IAAI,GAAG,cAAc,IAAI,OAAO,EAAE,CAAC;QAClE,KAAK,UAAU,CAAC;QAChB;YACC,OAAO,gCAAgC,IAAI,CAAC,IAAI,GAAG,cAAc,IAAI,OAAO,EAAE,CAAC;IACjF,CAAC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quereus/plugin-loader",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Plugin loading system for Quereus - supports dynamic imports for Node.js and browsers",
|
|
6
6
|
"publisher": "Got Choices Foundation",
|
|
@@ -28,12 +28,16 @@
|
|
|
28
28
|
"typecheck": "tsc --noEmit"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@quereus/quereus": "^0.
|
|
31
|
+
"@quereus/quereus": "^0.18.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@quereus/quereus": "*",
|
|
35
|
+
"@types/debug": "^4.1.12",
|
|
35
36
|
"@types/node": "^25.0.9",
|
|
36
37
|
"rimraf": "^6.1.2",
|
|
37
38
|
"typescript": "^5.9.3"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"debug": "^4.4.3"
|
|
38
42
|
}
|
|
39
43
|
}
|