@yumerijs/loader 3.0.0-alpha.1 → 3.0.1
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/index.js +7 -6
- package/dist/runtime/vueLoader.js +21 -21
- package/package.json +46 -46
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
|
-
import { Core, Logger, Context, fallback, I18n } from '@yumerijs/core';
|
|
2
|
+
import { Core, Logger, Context, fallback, Schema, I18n, resolvePluginModule } from '@yumerijs/core';
|
|
3
3
|
import * as fs from 'fs';
|
|
4
4
|
import { promisify } from 'util';
|
|
5
5
|
import { exec } from 'child_process';
|
|
@@ -146,7 +146,6 @@ export class PluginLoader {
|
|
|
146
146
|
this.logger.info(`Renderer "${rendererName}" is not registered. Attempting to auto-load...`);
|
|
147
147
|
try {
|
|
148
148
|
const rendererPackageMap = {
|
|
149
|
-
'vue': '@yumerijs/vue-renderer',
|
|
150
149
|
'react': '@yumerijs/react-renderer',
|
|
151
150
|
'ejs': '@yumerijs/ejs-renderer'
|
|
152
151
|
};
|
|
@@ -166,14 +165,14 @@ export class PluginLoader {
|
|
|
166
165
|
}
|
|
167
166
|
}
|
|
168
167
|
const deps = pluginInstance.depend || [];
|
|
169
|
-
const unmetDependencies = deps.filter(dep => !this.core.components[dep]);
|
|
168
|
+
const unmetDependencies = deps.filter(dep => !this.core.components[dep] && !this.core.services[dep]);
|
|
170
169
|
if (unmetDependencies.length > 0) {
|
|
171
170
|
return false;
|
|
172
171
|
}
|
|
173
172
|
this.plugins[pluginName] = pluginInstance;
|
|
174
173
|
// ### NEW CONFIG LOGIC ###
|
|
175
174
|
const rawConfig = (this.config.plugins && this.config.plugins[pluginName]) || {};
|
|
176
|
-
const schema = pluginInstance.config; // The schema is exported as 'config'
|
|
175
|
+
const schema = pluginInstance.config || Schema.object({}); // The schema is exported as 'config'
|
|
177
176
|
const finalConfig = fallback(schema, rawConfig);
|
|
178
177
|
// Update the in-memory config with the fully resolved one
|
|
179
178
|
this.config.plugins[pluginName] = finalConfig;
|
|
@@ -316,8 +315,10 @@ export class PluginLoader {
|
|
|
316
315
|
this.pluginWatchers[pluginName] = watcher;
|
|
317
316
|
}
|
|
318
317
|
async loadModule(pluginName) {
|
|
319
|
-
const
|
|
320
|
-
|
|
318
|
+
const pluginModule = await import(pluginName);
|
|
319
|
+
const context = this.getContext(pluginName, {});
|
|
320
|
+
const rawConfig = (this.config.plugins && this.config.plugins[pluginName]) || {};
|
|
321
|
+
return resolvePluginModule(pluginModule, context, rawConfig);
|
|
321
322
|
}
|
|
322
323
|
async checkPluginDependencies(pluginPath) {
|
|
323
324
|
return true;
|
|
@@ -36,14 +36,14 @@ export function registerVueRuntimeLoader() {
|
|
|
36
36
|
source: descriptor.template.content,
|
|
37
37
|
ssr: true
|
|
38
38
|
});
|
|
39
|
-
code = `
|
|
40
|
-
import { defineComponent } from 'vue';
|
|
41
|
-
${templateResult.code}
|
|
42
|
-
|
|
43
|
-
const __component__ = defineComponent({});
|
|
44
|
-
__component__.ssrRender = ssrRender;
|
|
45
|
-
|
|
46
|
-
export default __component__;
|
|
39
|
+
code = `
|
|
40
|
+
import { defineComponent } from 'vue';
|
|
41
|
+
${templateResult.code}
|
|
42
|
+
|
|
43
|
+
const __component__ = defineComponent({});
|
|
44
|
+
__component__.ssrRender = ssrRender;
|
|
45
|
+
|
|
46
|
+
export default __component__;
|
|
47
47
|
`;
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
@@ -63,19 +63,19 @@ export default __component__;
|
|
|
63
63
|
sourcemap: 'inline',
|
|
64
64
|
sourcefile: filename
|
|
65
65
|
});
|
|
66
|
-
const metadataCode = `
|
|
67
|
-
const __yumeri_raw__ = module.exports && module.exports.__esModule ? module.exports.default : module.exports;
|
|
68
|
-
const __yumeri_target__ = typeof __yumeri_raw__ === 'function' || (typeof __yumeri_raw__ === 'object' && __yumeri_raw__ !== null)
|
|
69
|
-
? __yumeri_raw__
|
|
70
|
-
: null;
|
|
71
|
-
if (__yumeri_target__) {
|
|
72
|
-
Object.defineProperty(__yumeri_target__, '__file', {
|
|
73
|
-
value: ${JSON.stringify(filename)},
|
|
74
|
-
enumerable: false,
|
|
75
|
-
configurable: true,
|
|
76
|
-
writable: true,
|
|
77
|
-
});
|
|
78
|
-
}
|
|
66
|
+
const metadataCode = `
|
|
67
|
+
const __yumeri_raw__ = module.exports && module.exports.__esModule ? module.exports.default : module.exports;
|
|
68
|
+
const __yumeri_target__ = typeof __yumeri_raw__ === 'function' || (typeof __yumeri_raw__ === 'object' && __yumeri_raw__ !== null)
|
|
69
|
+
? __yumeri_raw__
|
|
70
|
+
: null;
|
|
71
|
+
if (__yumeri_target__) {
|
|
72
|
+
Object.defineProperty(__yumeri_target__, '__file', {
|
|
73
|
+
value: ${JSON.stringify(filename)},
|
|
74
|
+
enumerable: false,
|
|
75
|
+
configurable: true,
|
|
76
|
+
writable: true,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
79
|
`;
|
|
80
80
|
nodeModule._compile(`${transformed.code}\n${metadataCode}`, filename);
|
|
81
81
|
}
|
package/package.json
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@yumerijs/loader",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "Module loader for yumeri",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist"
|
|
10
|
-
],
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "tsc",
|
|
13
|
-
"prepublishOnly": "npm run build"
|
|
14
|
-
},
|
|
15
|
-
"repository": {
|
|
16
|
-
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/yumerijs/yumeri.git"
|
|
18
|
-
},
|
|
19
|
-
"keywords": [
|
|
20
|
-
"yumeri",
|
|
21
|
-
"API"
|
|
22
|
-
],
|
|
23
|
-
"author": "WindyPear-Team,FireGuo",
|
|
24
|
-
"license": "MIT",
|
|
25
|
-
"bugs": {
|
|
26
|
-
"url": "https://github.com/yumerijs/yumeri/issues"
|
|
27
|
-
},
|
|
28
|
-
"homepage": "https://github.com/yumerijs/yumeri#readme",
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"@types/js-yaml": "^4.0.9",
|
|
31
|
-
"@types/node": "^22.13.10",
|
|
32
|
-
"@yumerijs/core": "^3.0.0
|
|
33
|
-
"esbuild-register": "^3.6.0",
|
|
34
|
-
"typescript": "^
|
|
35
|
-
},
|
|
36
|
-
"dependencies": {
|
|
37
|
-
"@types/js-yaml": "^4.0.9",
|
|
38
|
-
"@vue/compiler-sfc": "^3.5.25",
|
|
39
|
-
"chokidar": "^4.0.3",
|
|
40
|
-
"esbuild": "^0.
|
|
41
|
-
"js-yaml": "^4.1.0"
|
|
42
|
-
},
|
|
43
|
-
"peerDependencies": {
|
|
44
|
-
"@yumerijs/core": "^3.0.0
|
|
45
|
-
}
|
|
46
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@yumerijs/loader",
|
|
3
|
+
"version": "3.0.1",
|
|
4
|
+
"description": "Module loader for yumeri",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"prepublishOnly": "npm run build"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/yumerijs/yumeri.git"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"yumeri",
|
|
21
|
+
"API"
|
|
22
|
+
],
|
|
23
|
+
"author": "WindyPear-Team,FireGuo",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/yumerijs/yumeri/issues"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/yumerijs/yumeri#readme",
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/js-yaml": "^4.0.9",
|
|
31
|
+
"@types/node": "^22.13.10",
|
|
32
|
+
"@yumerijs/core": "^3.0.0",
|
|
33
|
+
"esbuild-register": "^3.6.0",
|
|
34
|
+
"typescript": "^6.0.3"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@types/js-yaml": "^4.0.9",
|
|
38
|
+
"@vue/compiler-sfc": "^3.5.25",
|
|
39
|
+
"chokidar": "^4.0.3",
|
|
40
|
+
"esbuild": "^0.28.1",
|
|
41
|
+
"js-yaml": "^4.1.0"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@yumerijs/core": "^3.0.0"
|
|
45
|
+
}
|
|
46
|
+
}
|