@powerlines/plugin-nitro 0.1.9 → 0.1.10
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.cjs +66 -1
- package/dist/index.mjs +64 -1
- package/dist/powerlines/src/plugin-utils/get-config-path.cjs +48 -1
- package/dist/powerlines/src/plugin-utils/get-config-path.mjs +48 -1
- package/dist/powerlines/src/types/context.d.cts +27 -3
- package/dist/powerlines/src/types/context.d.mts +27 -3
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -1 +1,66 @@
|
|
|
1
|
-
Object.defineProperty(exports
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
const require_get_config_path = require('./powerlines/src/plugin-utils/get-config-path.cjs');
|
|
3
|
+
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
4
|
+
let __stryke_path_append = require("@stryke/path/append");
|
|
5
|
+
let nitro_builder = require("nitro/builder");
|
|
6
|
+
|
|
7
|
+
//#region src/index.ts
|
|
8
|
+
/**
|
|
9
|
+
* A Powerlines plugin to integrate with Nitro.
|
|
10
|
+
*/
|
|
11
|
+
const plugin = (options = {}) => {
|
|
12
|
+
return [{
|
|
13
|
+
name: "nitro:config",
|
|
14
|
+
async config() {
|
|
15
|
+
this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, "Providing default configuration for the Powerlines `nitro` plugin.");
|
|
16
|
+
let configFile = options.configFile;
|
|
17
|
+
if (!configFile) configFile = require_get_config_path.getConfigPath(this, "nitro");
|
|
18
|
+
return { nitro: {
|
|
19
|
+
configFile: configFile ? (0, __stryke_path_append.appendPath)(configFile, this.workspaceConfig.workspaceRoot) : void 0,
|
|
20
|
+
...options
|
|
21
|
+
} };
|
|
22
|
+
},
|
|
23
|
+
configResolved() {
|
|
24
|
+
this.config.nitro.compatibilityDate = this.config.compatibilityDate;
|
|
25
|
+
this.config.nitro.workspaceDir = this.workspaceConfig.workspaceRoot;
|
|
26
|
+
this.config.nitro.alias = this.config.build.alias;
|
|
27
|
+
switch (this.config.logLevel) {
|
|
28
|
+
case "error":
|
|
29
|
+
this.config.nitro.logLevel = 1;
|
|
30
|
+
break;
|
|
31
|
+
case "warn":
|
|
32
|
+
this.config.nitro.logLevel = 2;
|
|
33
|
+
break;
|
|
34
|
+
case "info":
|
|
35
|
+
this.config.nitro.logLevel = 3;
|
|
36
|
+
break;
|
|
37
|
+
case "debug":
|
|
38
|
+
this.config.nitro.logLevel = 4;
|
|
39
|
+
break;
|
|
40
|
+
case "trace":
|
|
41
|
+
this.config.nitro.logLevel = 5;
|
|
42
|
+
break;
|
|
43
|
+
case null:
|
|
44
|
+
this.config.nitro.logLevel = 0;
|
|
45
|
+
break;
|
|
46
|
+
default:
|
|
47
|
+
this.config.nitro.logLevel = 2;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
name: "nitro:init",
|
|
53
|
+
configResolved: {
|
|
54
|
+
order: "post",
|
|
55
|
+
async handler() {
|
|
56
|
+
this.nitro ??= {};
|
|
57
|
+
this.nitro.nitro = await (0, nitro_builder.createNitro)(this.config.nitro);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}];
|
|
61
|
+
};
|
|
62
|
+
var src_default = plugin;
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
exports.default = src_default;
|
|
66
|
+
exports.plugin = plugin;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1,64 @@
|
|
|
1
|
-
import{getConfigPath
|
|
1
|
+
import { getConfigPath } from "./powerlines/src/plugin-utils/get-config-path.mjs";
|
|
2
|
+
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
3
|
+
import { appendPath } from "@stryke/path/append";
|
|
4
|
+
import { createNitro } from "nitro/builder";
|
|
5
|
+
|
|
6
|
+
//#region src/index.ts
|
|
7
|
+
/**
|
|
8
|
+
* A Powerlines plugin to integrate with Nitro.
|
|
9
|
+
*/
|
|
10
|
+
const plugin = (options = {}) => {
|
|
11
|
+
return [{
|
|
12
|
+
name: "nitro:config",
|
|
13
|
+
async config() {
|
|
14
|
+
this.log(LogLevelLabel.TRACE, "Providing default configuration for the Powerlines `nitro` plugin.");
|
|
15
|
+
let configFile = options.configFile;
|
|
16
|
+
if (!configFile) configFile = getConfigPath(this, "nitro");
|
|
17
|
+
return { nitro: {
|
|
18
|
+
configFile: configFile ? appendPath(configFile, this.workspaceConfig.workspaceRoot) : void 0,
|
|
19
|
+
...options
|
|
20
|
+
} };
|
|
21
|
+
},
|
|
22
|
+
configResolved() {
|
|
23
|
+
this.config.nitro.compatibilityDate = this.config.compatibilityDate;
|
|
24
|
+
this.config.nitro.workspaceDir = this.workspaceConfig.workspaceRoot;
|
|
25
|
+
this.config.nitro.alias = this.config.build.alias;
|
|
26
|
+
switch (this.config.logLevel) {
|
|
27
|
+
case "error":
|
|
28
|
+
this.config.nitro.logLevel = 1;
|
|
29
|
+
break;
|
|
30
|
+
case "warn":
|
|
31
|
+
this.config.nitro.logLevel = 2;
|
|
32
|
+
break;
|
|
33
|
+
case "info":
|
|
34
|
+
this.config.nitro.logLevel = 3;
|
|
35
|
+
break;
|
|
36
|
+
case "debug":
|
|
37
|
+
this.config.nitro.logLevel = 4;
|
|
38
|
+
break;
|
|
39
|
+
case "trace":
|
|
40
|
+
this.config.nitro.logLevel = 5;
|
|
41
|
+
break;
|
|
42
|
+
case null:
|
|
43
|
+
this.config.nitro.logLevel = 0;
|
|
44
|
+
break;
|
|
45
|
+
default:
|
|
46
|
+
this.config.nitro.logLevel = 2;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
name: "nitro:init",
|
|
52
|
+
configResolved: {
|
|
53
|
+
order: "post",
|
|
54
|
+
async handler() {
|
|
55
|
+
this.nitro ??= {};
|
|
56
|
+
this.nitro.nitro = await createNitro(this.config.nitro);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}];
|
|
60
|
+
};
|
|
61
|
+
var src_default = plugin;
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { src_default as default, plugin };
|
|
@@ -1 +1,48 @@
|
|
|
1
|
-
let
|
|
1
|
+
let __stryke_path_join = require("@stryke/path/join");
|
|
2
|
+
let node_fs = require("node:fs");
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/plugin-utils/get-config-path.ts
|
|
5
|
+
/**
|
|
6
|
+
* Get the configuration file path for a given name.
|
|
7
|
+
*
|
|
8
|
+
* @param context - The Powerlines context.
|
|
9
|
+
* @param name - The name of the configuration file (without extension).
|
|
10
|
+
* @returns The absolute path to the configuration file, or undefined if not found.
|
|
11
|
+
*/
|
|
12
|
+
function getConfigPath(context, name) {
|
|
13
|
+
if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yml`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yml`);
|
|
14
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yaml`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yaml`);
|
|
15
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.json`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.json`);
|
|
16
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.jsonc`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.jsonc`);
|
|
17
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.ts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.ts`);
|
|
18
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cts`);
|
|
19
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mts`);
|
|
20
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.js`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.js`);
|
|
21
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cjs`);
|
|
22
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mjs`);
|
|
23
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.ts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.ts`);
|
|
24
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cts`);
|
|
25
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mts`);
|
|
26
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.js`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.js`);
|
|
27
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cjs`);
|
|
28
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mjs`);
|
|
29
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.yml`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.yml`);
|
|
30
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.yaml`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.yaml`);
|
|
31
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.json`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.json`);
|
|
32
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.jsonc`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.jsonc`);
|
|
33
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.ts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.ts`);
|
|
34
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.cts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.cts`);
|
|
35
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.mts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.mts`);
|
|
36
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.js`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.js`);
|
|
37
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.cjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.cjs`);
|
|
38
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.mjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.mjs`);
|
|
39
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.ts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.ts`);
|
|
40
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.cts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.cts`);
|
|
41
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.mts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.mts`);
|
|
42
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.js`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.js`);
|
|
43
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`);
|
|
44
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
exports.getConfigPath = getConfigPath;
|
|
@@ -1 +1,48 @@
|
|
|
1
|
-
import{joinPaths
|
|
1
|
+
import { joinPaths } from "@stryke/path/join";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/plugin-utils/get-config-path.ts
|
|
5
|
+
/**
|
|
6
|
+
* Get the configuration file path for a given name.
|
|
7
|
+
*
|
|
8
|
+
* @param context - The Powerlines context.
|
|
9
|
+
* @param name - The name of the configuration file (without extension).
|
|
10
|
+
* @returns The absolute path to the configuration file, or undefined if not found.
|
|
11
|
+
*/
|
|
12
|
+
function getConfigPath(context, name) {
|
|
13
|
+
if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yml`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yml`);
|
|
14
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yaml`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yaml`);
|
|
15
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.json`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.json`);
|
|
16
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.jsonc`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.jsonc`);
|
|
17
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.ts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.ts`);
|
|
18
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cts`);
|
|
19
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mts`);
|
|
20
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.js`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.js`);
|
|
21
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cjs`);
|
|
22
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mjs`);
|
|
23
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.ts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.ts`);
|
|
24
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cts`);
|
|
25
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mts`);
|
|
26
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.js`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.js`);
|
|
27
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cjs`);
|
|
28
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mjs`);
|
|
29
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.yml`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.yml`);
|
|
30
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.yaml`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.yaml`);
|
|
31
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.json`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.json`);
|
|
32
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.jsonc`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.jsonc`);
|
|
33
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.ts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.ts`);
|
|
34
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.cts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.cts`);
|
|
35
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.mts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.mts`);
|
|
36
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.js`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.js`);
|
|
37
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.cjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.cjs`);
|
|
38
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.mjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.mjs`);
|
|
39
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.ts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.ts`);
|
|
40
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.cts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.cts`);
|
|
41
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.mts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.mts`);
|
|
42
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.js`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.js`);
|
|
43
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`);
|
|
44
|
+
else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { getConfigPath };
|
|
@@ -78,10 +78,18 @@ interface ParseOptions extends ParserOptions {
|
|
|
78
78
|
*/
|
|
79
79
|
allowReturnOutsideFunction?: boolean;
|
|
80
80
|
}
|
|
81
|
+
interface EmitOptions extends WriteOptions {
|
|
82
|
+
/**
|
|
83
|
+
* If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
|
|
84
|
+
*/
|
|
85
|
+
emitWithBundler?: boolean;
|
|
86
|
+
needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
|
|
87
|
+
originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
|
|
88
|
+
}
|
|
81
89
|
/**
|
|
82
90
|
* Options for emitting entry virtual files
|
|
83
91
|
*/
|
|
84
|
-
type EmitEntryOptions =
|
|
92
|
+
type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
|
|
85
93
|
/**
|
|
86
94
|
* The unresolved Powerlines context.
|
|
87
95
|
*
|
|
@@ -292,6 +300,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
292
300
|
* The Powerlines builtin virtual files
|
|
293
301
|
*/
|
|
294
302
|
getBuiltins: () => Promise<VirtualFile[]>;
|
|
303
|
+
/**
|
|
304
|
+
* Resolves a file and writes it to the VFS if it does not already exist
|
|
305
|
+
*
|
|
306
|
+
* @param code - The source code of the file
|
|
307
|
+
* @param path - The path to write the file to
|
|
308
|
+
* @param options - Additional options for writing the file
|
|
309
|
+
*/
|
|
310
|
+
emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
|
|
311
|
+
/**
|
|
312
|
+
* Synchronously resolves a file and writes it to the VFS if it does not already exist
|
|
313
|
+
*
|
|
314
|
+
* @param code - The source code of the file
|
|
315
|
+
* @param path - The path to write the file to
|
|
316
|
+
* @param options - Additional options for writing the file
|
|
317
|
+
*/
|
|
318
|
+
emitSync: (code: string, path: string, options?: EmitOptions) => void;
|
|
295
319
|
/**
|
|
296
320
|
* Resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
297
321
|
*
|
|
@@ -300,7 +324,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
300
324
|
* @param path - An optional path to write the builtin file to
|
|
301
325
|
* @param options - Additional options for writing the builtin file
|
|
302
326
|
*/
|
|
303
|
-
emitBuiltin: (code: string, id: string, path?: string, options?:
|
|
327
|
+
emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
|
|
304
328
|
/**
|
|
305
329
|
* Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
306
330
|
*
|
|
@@ -309,7 +333,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
309
333
|
* @param path - An optional path to write the builtin file to
|
|
310
334
|
* @param options - Additional options for writing the builtin file
|
|
311
335
|
*/
|
|
312
|
-
emitBuiltinSync: (code: string, id: string, path?: string, options?:
|
|
336
|
+
emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
|
|
313
337
|
/**
|
|
314
338
|
* Resolves a entry virtual file and writes it to the VFS if it does not already exist
|
|
315
339
|
*
|
|
@@ -80,10 +80,18 @@ interface ParseOptions extends ParserOptions {
|
|
|
80
80
|
*/
|
|
81
81
|
allowReturnOutsideFunction?: boolean;
|
|
82
82
|
}
|
|
83
|
+
interface EmitOptions extends WriteOptions {
|
|
84
|
+
/**
|
|
85
|
+
* If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
|
|
86
|
+
*/
|
|
87
|
+
emitWithBundler?: boolean;
|
|
88
|
+
needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
|
|
89
|
+
originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
|
|
90
|
+
}
|
|
83
91
|
/**
|
|
84
92
|
* Options for emitting entry virtual files
|
|
85
93
|
*/
|
|
86
|
-
type EmitEntryOptions =
|
|
94
|
+
type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
|
|
87
95
|
/**
|
|
88
96
|
* The unresolved Powerlines context.
|
|
89
97
|
*
|
|
@@ -294,6 +302,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
294
302
|
* The Powerlines builtin virtual files
|
|
295
303
|
*/
|
|
296
304
|
getBuiltins: () => Promise<VirtualFile[]>;
|
|
305
|
+
/**
|
|
306
|
+
* Resolves a file and writes it to the VFS if it does not already exist
|
|
307
|
+
*
|
|
308
|
+
* @param code - The source code of the file
|
|
309
|
+
* @param path - The path to write the file to
|
|
310
|
+
* @param options - Additional options for writing the file
|
|
311
|
+
*/
|
|
312
|
+
emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* Synchronously resolves a file and writes it to the VFS if it does not already exist
|
|
315
|
+
*
|
|
316
|
+
* @param code - The source code of the file
|
|
317
|
+
* @param path - The path to write the file to
|
|
318
|
+
* @param options - Additional options for writing the file
|
|
319
|
+
*/
|
|
320
|
+
emitSync: (code: string, path: string, options?: EmitOptions) => void;
|
|
297
321
|
/**
|
|
298
322
|
* Resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
299
323
|
*
|
|
@@ -302,7 +326,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
302
326
|
* @param path - An optional path to write the builtin file to
|
|
303
327
|
* @param options - Additional options for writing the builtin file
|
|
304
328
|
*/
|
|
305
|
-
emitBuiltin: (code: string, id: string, path?: string, options?:
|
|
329
|
+
emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
|
|
306
330
|
/**
|
|
307
331
|
* Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
|
|
308
332
|
*
|
|
@@ -311,7 +335,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
311
335
|
* @param path - An optional path to write the builtin file to
|
|
312
336
|
* @param options - Additional options for writing the builtin file
|
|
313
337
|
*/
|
|
314
|
-
emitBuiltinSync: (code: string, id: string, path?: string, options?:
|
|
338
|
+
emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
|
|
315
339
|
/**
|
|
316
340
|
* Resolves a entry virtual file and writes it to the VFS if it does not already exist
|
|
317
341
|
*
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/dist/types/plugin.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-nitro",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin for creating a server application that runs on Nitro.",
|
|
6
6
|
"repository": {
|
|
@@ -101,19 +101,19 @@
|
|
|
101
101
|
"keywords": ["nitro", "powerlines", "storm-software", "powerlines-plugin"],
|
|
102
102
|
"dependencies": {
|
|
103
103
|
"@storm-software/config-tools": "^1.188.74",
|
|
104
|
-
"@stryke/cli": "^0.12.
|
|
105
|
-
"@stryke/convert": "^0.6.
|
|
106
|
-
"@stryke/fs": "^0.33.
|
|
107
|
-
"@stryke/path": "^0.24.
|
|
104
|
+
"@stryke/cli": "^0.12.37",
|
|
105
|
+
"@stryke/convert": "^0.6.30",
|
|
106
|
+
"@stryke/fs": "^0.33.27",
|
|
107
|
+
"@stryke/path": "^0.24.1",
|
|
108
108
|
"defu": "^6.1.4",
|
|
109
109
|
"nitro": "3.0.1-alpha.1",
|
|
110
|
-
"powerlines": "^0.36.
|
|
110
|
+
"powerlines": "^0.36.23"
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|
|
113
|
-
"@powerlines/nx": "^0.11.
|
|
113
|
+
"@powerlines/nx": "^0.11.49",
|
|
114
114
|
"@storm-software/tsup": "^0.2.72",
|
|
115
115
|
"@types/node": "^24.10.4"
|
|
116
116
|
},
|
|
117
117
|
"publishConfig": { "access": "public" },
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "be47e546b48b9a82e460b5c5d4f02fb66e821f18"
|
|
119
119
|
}
|