@jay-framework/stack-server-runtime 0.16.3 → 0.16.5
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.d.ts +2 -0
- package/dist/index.js +24 -23
- package/package.json +13 -13
package/dist/index.d.ts
CHANGED
|
@@ -517,6 +517,8 @@ interface PluginWithInit {
|
|
|
517
517
|
* Can be overridden via `init` property in plugin.yaml (for compiled packages).
|
|
518
518
|
*/
|
|
519
519
|
initExport: string;
|
|
520
|
+
/** Whether init was explicitly declared or confirmed to exist */
|
|
521
|
+
initConfirmed: boolean;
|
|
520
522
|
/** Dependencies from package.json (for ordering) */
|
|
521
523
|
dependencies: string[];
|
|
522
524
|
/** When true, plugin is loaded on every page regardless of usage in jay-html */
|
package/dist/index.js
CHANGED
|
@@ -2013,6 +2013,7 @@ async function discoverPluginsWithInit(options) {
|
|
|
2013
2013
|
isLocal: scanned.isLocal,
|
|
2014
2014
|
initModule: initConfig.module,
|
|
2015
2015
|
initExport: initConfig.export,
|
|
2016
|
+
initConfirmed: initConfig.explicit,
|
|
2016
2017
|
dependencies: scanned.dependencies,
|
|
2017
2018
|
global: scanned.manifest.global === true
|
|
2018
2019
|
});
|
|
@@ -2035,27 +2036,14 @@ function resolvePluginInit(pluginPath, initConfig, isLocal) {
|
|
|
2035
2036
|
if (fs.existsSync(initPath)) {
|
|
2036
2037
|
const relativePath = path.relative(pluginPath, initPath);
|
|
2037
2038
|
const modulePath = relativePath.replace(/\.(ts|js)$/, "");
|
|
2038
|
-
const
|
|
2039
|
-
return { module: modulePath, export:
|
|
2039
|
+
const exportName2 = typeof initConfig === "string" ? initConfig : defaultExport;
|
|
2040
|
+
return { module: modulePath, export: exportName2, explicit: true };
|
|
2040
2041
|
}
|
|
2041
2042
|
}
|
|
2042
2043
|
return null;
|
|
2043
2044
|
}
|
|
2044
|
-
const
|
|
2045
|
-
|
|
2046
|
-
return null;
|
|
2047
|
-
}
|
|
2048
|
-
try {
|
|
2049
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
2050
|
-
const hasMain = packageJson.main || packageJson.exports;
|
|
2051
|
-
if (!hasMain && !initConfig) {
|
|
2052
|
-
return null;
|
|
2053
|
-
}
|
|
2054
|
-
const exportName = typeof initConfig === "string" ? initConfig : defaultExport;
|
|
2055
|
-
return { module: "", export: exportName };
|
|
2056
|
-
} catch {
|
|
2057
|
-
return null;
|
|
2058
|
-
}
|
|
2045
|
+
const exportName = typeof initConfig === "string" ? initConfig : defaultExport;
|
|
2046
|
+
return { module: "", export: exportName, explicit: !!initConfig };
|
|
2059
2047
|
}
|
|
2060
2048
|
function sortPluginsByDependencies(plugins) {
|
|
2061
2049
|
const pluginNames = new Set(plugins.map((p) => p.packageName));
|
|
@@ -2107,11 +2095,14 @@ async function executePluginServerInits(plugins, viteServer, verbose = false) {
|
|
|
2107
2095
|
}
|
|
2108
2096
|
const jayInit = pluginModule[plugin.initExport];
|
|
2109
2097
|
if (!jayInit || jayInit.__brand !== "JayInit") {
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2098
|
+
if (plugin.initConfirmed) {
|
|
2099
|
+
getLogger().warn(
|
|
2100
|
+
`[PluginInit] Plugin "${plugin.name}" init module doesn't export a valid JayInit at "${plugin.initExport}"`
|
|
2101
|
+
);
|
|
2102
|
+
}
|
|
2113
2103
|
continue;
|
|
2114
2104
|
}
|
|
2105
|
+
plugin.initConfirmed = true;
|
|
2115
2106
|
if (typeof jayInit._serverInit === "function") {
|
|
2116
2107
|
if (verbose) {
|
|
2117
2108
|
getLogger().info(`[DevServer] Running server init: ${plugin.name}`);
|
|
@@ -2132,7 +2123,7 @@ async function executePluginServerInits(plugins, viteServer, verbose = false) {
|
|
|
2132
2123
|
return initErrors;
|
|
2133
2124
|
}
|
|
2134
2125
|
function preparePluginClientInits(plugins) {
|
|
2135
|
-
return plugins.map((plugin) => {
|
|
2126
|
+
return plugins.filter((p) => p.initConfirmed).map((plugin) => {
|
|
2136
2127
|
let importPath;
|
|
2137
2128
|
if (plugin.isLocal) {
|
|
2138
2129
|
importPath = path.join(plugin.pluginPath, plugin.initModule);
|
|
@@ -2631,9 +2622,19 @@ async function materializeContracts(options, services = /* @__PURE__ */ new Map(
|
|
|
2631
2622
|
viteServer
|
|
2632
2623
|
);
|
|
2633
2624
|
const prefix = config.prefix;
|
|
2625
|
+
if (generatedContracts.length > 1) {
|
|
2626
|
+
const missing = generatedContracts.filter((c) => !c.name);
|
|
2627
|
+
if (missing.length > 0) {
|
|
2628
|
+
getLogger().error(
|
|
2629
|
+
` ❌ Dynamic contract generator for "${prefix}" returned ${generatedContracts.length} contracts but ${missing.length} are missing a name. Names are required when a generator returns multiple contracts.`
|
|
2630
|
+
);
|
|
2631
|
+
continue;
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
2634
|
for (const generated of generatedContracts) {
|
|
2635
|
-
const
|
|
2636
|
-
const
|
|
2635
|
+
const kebabName = generated.name ? toKebabCase(generated.name) : null;
|
|
2636
|
+
const fullName = kebabName ? `${prefix}/${kebabName}` : prefix;
|
|
2637
|
+
const fileName = kebabName ? `${prefix}-${kebabName}.jay-contract` : `${prefix}.jay-contract`;
|
|
2637
2638
|
const filePath = path.join(pluginOutputDir, fileName);
|
|
2638
2639
|
fs.writeFileSync(filePath, generated.yaml, "utf-8");
|
|
2639
2640
|
const relativePath = path.relative(projectRoot, filePath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/stack-server-runtime",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.mts",
|
|
@@ -26,21 +26,21 @@
|
|
|
26
26
|
"test:watch": "vitest"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@jay-framework/compiler-jay-html": "^0.16.
|
|
30
|
-
"@jay-framework/compiler-shared": "^0.16.
|
|
31
|
-
"@jay-framework/component": "^0.16.
|
|
32
|
-
"@jay-framework/fullstack-component": "^0.16.
|
|
33
|
-
"@jay-framework/logger": "^0.16.
|
|
34
|
-
"@jay-framework/runtime": "^0.16.
|
|
35
|
-
"@jay-framework/ssr-runtime": "^0.16.
|
|
36
|
-
"@jay-framework/stack-route-scanner": "^0.16.
|
|
37
|
-
"@jay-framework/view-state-merge": "^0.16.
|
|
29
|
+
"@jay-framework/compiler-jay-html": "^0.16.5",
|
|
30
|
+
"@jay-framework/compiler-shared": "^0.16.5",
|
|
31
|
+
"@jay-framework/component": "^0.16.5",
|
|
32
|
+
"@jay-framework/fullstack-component": "^0.16.5",
|
|
33
|
+
"@jay-framework/logger": "^0.16.5",
|
|
34
|
+
"@jay-framework/runtime": "^0.16.5",
|
|
35
|
+
"@jay-framework/ssr-runtime": "^0.16.5",
|
|
36
|
+
"@jay-framework/stack-route-scanner": "^0.16.5",
|
|
37
|
+
"@jay-framework/view-state-merge": "^0.16.5",
|
|
38
38
|
"yaml": "^2.3.4"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@jay-framework/dev-environment": "^0.16.
|
|
42
|
-
"@jay-framework/jay-cli": "^0.16.
|
|
43
|
-
"@jay-framework/stack-client-runtime": "^0.16.
|
|
41
|
+
"@jay-framework/dev-environment": "^0.16.5",
|
|
42
|
+
"@jay-framework/jay-cli": "^0.16.5",
|
|
43
|
+
"@jay-framework/stack-client-runtime": "^0.16.5",
|
|
44
44
|
"@types/express": "^5.0.2",
|
|
45
45
|
"@types/node": "^22.15.21",
|
|
46
46
|
"nodemon": "^3.0.3",
|