@yumerijs/loader 3.0.0-alpha.1 → 3.0.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/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
  };
@@ -173,7 +172,7 @@ export class PluginLoader {
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 plugin = await import(pluginName);
320
- return plugin.default || plugin;
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@yumerijs/loader",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0",
4
4
  "description": "Module loader for yumeri",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,18 +29,18 @@
29
29
  "devDependencies": {
30
30
  "@types/js-yaml": "^4.0.9",
31
31
  "@types/node": "^22.13.10",
32
- "@yumerijs/core": "^3.0.0-alpha.1",
32
+ "@yumerijs/core": "^3.0.0",
33
33
  "esbuild-register": "^3.6.0",
34
- "typescript": "^5.8.2"
34
+ "typescript": "^6.0.3"
35
35
  },
36
36
  "dependencies": {
37
37
  "@types/js-yaml": "^4.0.9",
38
38
  "@vue/compiler-sfc": "^3.5.25",
39
39
  "chokidar": "^4.0.3",
40
- "esbuild": "^0.25.9",
40
+ "esbuild": "^0.28.1",
41
41
  "js-yaml": "^4.1.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@yumerijs/core": "^3.0.0-alpha.1"
44
+ "@yumerijs/core": "^3.0.0"
45
45
  }
46
- }
46
+ }