@powerlines/plugin-capnp 0.1.460 → 0.1.462
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/_virtual/_rolldown/runtime.cjs +29 -1
- package/dist/index.cjs +57 -1
- package/dist/index.mjs +53 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +4 -4
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
exports.__toESM = __toESM;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,57 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _stryke_capnp_compile = require("@stryke/capnp/compile");
|
|
4
|
+
let _stryke_capnp_helpers = require("@stryke/capnp/helpers");
|
|
5
|
+
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
6
|
+
let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
|
|
7
|
+
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
8
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
9
|
+
let defu = require("defu");
|
|
10
|
+
defu = require_runtime.__toESM(defu, 1);
|
|
11
|
+
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
12
|
+
|
|
13
|
+
//#region src/index.ts
|
|
14
|
+
/**
|
|
15
|
+
* A Powerlines plugin to integrate Cap'n Proto for code generation.
|
|
16
|
+
*
|
|
17
|
+
* @param options - The plugin options.
|
|
18
|
+
* @returns A Powerlines plugin instance.
|
|
19
|
+
*/
|
|
20
|
+
const plugin = (options = {}) => {
|
|
21
|
+
return {
|
|
22
|
+
name: "capnp",
|
|
23
|
+
config() {
|
|
24
|
+
return { capnp: (0, defu.default)(options, {
|
|
25
|
+
ts: true,
|
|
26
|
+
js: false,
|
|
27
|
+
dts: false,
|
|
28
|
+
tty: true,
|
|
29
|
+
tsconfig: this.tsconfig,
|
|
30
|
+
schema: (0, _stryke_path_join_paths.joinPaths)(this.config.cwd ?? "./", this.config.root, "*.capnp"),
|
|
31
|
+
outputPath: (0, _stryke_path_join_paths.joinPaths)("{builtinPath}", "capnp")
|
|
32
|
+
}) };
|
|
33
|
+
},
|
|
34
|
+
configResolved() {
|
|
35
|
+
this.config.capnp.outputPath = (0, powerlines_plugin_utils.replacePathTokens)(this, this.config.capnp.outputPath);
|
|
36
|
+
},
|
|
37
|
+
async prepare() {
|
|
38
|
+
const resolvedOptions = await (0, _stryke_capnp_helpers.resolveOptions)({
|
|
39
|
+
...this.config.capnp,
|
|
40
|
+
schemas: this.config.capnp.schema.toString(),
|
|
41
|
+
projectRoot: this.config.root,
|
|
42
|
+
workspaceRoot: this.config.cwd
|
|
43
|
+
});
|
|
44
|
+
if (!resolvedOptions?.schemas?.length) {
|
|
45
|
+
this.warn("No Cap'n Proto schemas found to compile.");
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const result = await (0, _stryke_capnp_compile.capnpc)(resolvedOptions);
|
|
49
|
+
if ((0, _stryke_path_is_parent_path.isParentPath)(this.config.capnp.outputPath, this.builtinsPath)) await Promise.all(Object.entries(result.files).map(async ([filePath, content]) => this.emitBuiltin(content, (0, _stryke_path_file_path_fns.findFileName)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_replace.replacePath)(this.config.capnp.outputPath, this.builtinsPath), filePath), { withExtension: false }))));
|
|
50
|
+
else await Promise.all(Object.entries(result.files).map(async ([filePath, content]) => this.fs.write((0, _stryke_path_join_paths.joinPaths)(this.config.capnp.outputPath, filePath), content)));
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
exports.default = plugin;
|
|
57
|
+
exports.plugin = plugin;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,54 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { capnpc } from "@stryke/capnp/compile";
|
|
2
|
+
import { resolveOptions } from "@stryke/capnp/helpers";
|
|
3
|
+
import { findFileName } from "@stryke/path/file-path-fns";
|
|
4
|
+
import { isParentPath } from "@stryke/path/is-parent-path";
|
|
5
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
6
|
+
import { replacePath } from "@stryke/path/replace";
|
|
7
|
+
import defu from "defu";
|
|
8
|
+
import { replacePathTokens } from "powerlines/plugin-utils";
|
|
9
|
+
|
|
10
|
+
//#region src/index.ts
|
|
11
|
+
/**
|
|
12
|
+
* A Powerlines plugin to integrate Cap'n Proto for code generation.
|
|
13
|
+
*
|
|
14
|
+
* @param options - The plugin options.
|
|
15
|
+
* @returns A Powerlines plugin instance.
|
|
16
|
+
*/
|
|
17
|
+
const plugin = (options = {}) => {
|
|
18
|
+
return {
|
|
19
|
+
name: "capnp",
|
|
20
|
+
config() {
|
|
21
|
+
return { capnp: defu(options, {
|
|
22
|
+
ts: true,
|
|
23
|
+
js: false,
|
|
24
|
+
dts: false,
|
|
25
|
+
tty: true,
|
|
26
|
+
tsconfig: this.tsconfig,
|
|
27
|
+
schema: joinPaths(this.config.cwd ?? "./", this.config.root, "*.capnp"),
|
|
28
|
+
outputPath: joinPaths("{builtinPath}", "capnp")
|
|
29
|
+
}) };
|
|
30
|
+
},
|
|
31
|
+
configResolved() {
|
|
32
|
+
this.config.capnp.outputPath = replacePathTokens(this, this.config.capnp.outputPath);
|
|
33
|
+
},
|
|
34
|
+
async prepare() {
|
|
35
|
+
const resolvedOptions = await resolveOptions({
|
|
36
|
+
...this.config.capnp,
|
|
37
|
+
schemas: this.config.capnp.schema.toString(),
|
|
38
|
+
projectRoot: this.config.root,
|
|
39
|
+
workspaceRoot: this.config.cwd
|
|
40
|
+
});
|
|
41
|
+
if (!resolvedOptions?.schemas?.length) {
|
|
42
|
+
this.warn("No Cap'n Proto schemas found to compile.");
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const result = await capnpc(resolvedOptions);
|
|
46
|
+
if (isParentPath(this.config.capnp.outputPath, this.builtinsPath)) await Promise.all(Object.entries(result.files).map(async ([filePath, content]) => this.emitBuiltin(content, findFileName(joinPaths(replacePath(this.config.capnp.outputPath, this.builtinsPath), filePath), { withExtension: false }))));
|
|
47
|
+
else await Promise.all(Object.entries(result.files).map(async ([filePath, content]) => this.fs.write(joinPaths(this.config.capnp.outputPath, filePath), content)));
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
export { plugin as default, plugin };
|
|
2
54
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { capnpc } from \"@stryke/capnp/compile\";\nimport { resolveOptions } from \"@stryke/capnp/helpers\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport { replacePathTokens } from \"powerlines/plugin-utils\";\nimport { CapnpPluginContext, CapnpPluginOptions } from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n capnp?: CapnpPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to integrate Cap'n Proto for code generation.\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends CapnpPluginContext = CapnpPluginContext\n>(\n options: CapnpPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"capnp\",\n config() {\n return {\n capnp: defu(options, {\n ts: true,\n js: false,\n dts: false,\n tty: true,\n tsconfig: this.tsconfig,\n schema: joinPaths(\n this.config.cwd ?? \"./\",\n this.config.root,\n \"*.capnp\"\n ),\n outputPath: joinPaths(\"{builtinPath}\", \"capnp\")\n })\n };\n },\n configResolved() {\n this.config.capnp.outputPath = replacePathTokens(\n this,\n this.config.capnp.outputPath\n );\n },\n async prepare() {\n const resolvedOptions = await resolveOptions({\n ...this.config.capnp,\n schemas: this.config.capnp.schema.toString(),\n projectRoot: this.config.root,\n workspaceRoot: this.config.cwd\n });\n if (!resolvedOptions?.schemas?.length) {\n this.warn(\"No Cap'n Proto schemas found to compile.\");\n\n return;\n }\n\n const result = await capnpc(resolvedOptions);\n\n if (isParentPath(this.config.capnp.outputPath, this.builtinsPath)) {\n await Promise.all(\n Object.entries(result.files).map(async ([filePath, content]) =>\n this.emitBuiltin(\n content,\n findFileName(\n joinPaths(\n replacePath(this.config.capnp.outputPath, this.builtinsPath),\n filePath\n ),\n { withExtension: false }\n )\n )\n )\n );\n } else {\n await Promise.all(\n Object.entries(result.files).map(async ([filePath, content]) =>\n this.fs.write(\n joinPaths(this.config.capnp.outputPath, filePath),\n content\n )\n )\n );\n }\n }\n };\n};\n\nexport default plugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { capnpc } from \"@stryke/capnp/compile\";\nimport { resolveOptions } from \"@stryke/capnp/helpers\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport { replacePathTokens } from \"powerlines/plugin-utils\";\nimport { CapnpPluginContext, CapnpPluginOptions } from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n capnp?: CapnpPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to integrate Cap'n Proto for code generation.\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends CapnpPluginContext = CapnpPluginContext\n>(\n options: CapnpPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"capnp\",\n config() {\n return {\n capnp: defu(options, {\n ts: true,\n js: false,\n dts: false,\n tty: true,\n tsconfig: this.tsconfig,\n schema: joinPaths(\n this.config.cwd ?? \"./\",\n this.config.root,\n \"*.capnp\"\n ),\n outputPath: joinPaths(\"{builtinPath}\", \"capnp\")\n })\n };\n },\n configResolved() {\n this.config.capnp.outputPath = replacePathTokens(\n this,\n this.config.capnp.outputPath\n );\n },\n async prepare() {\n const resolvedOptions = await resolveOptions({\n ...this.config.capnp,\n schemas: this.config.capnp.schema.toString(),\n projectRoot: this.config.root,\n workspaceRoot: this.config.cwd\n });\n if (!resolvedOptions?.schemas?.length) {\n this.warn(\"No Cap'n Proto schemas found to compile.\");\n\n return;\n }\n\n const result = await capnpc(resolvedOptions);\n\n if (isParentPath(this.config.capnp.outputPath, this.builtinsPath)) {\n await Promise.all(\n Object.entries(result.files).map(async ([filePath, content]) =>\n this.emitBuiltin(\n content,\n findFileName(\n joinPaths(\n replacePath(this.config.capnp.outputPath, this.builtinsPath),\n filePath\n ),\n { withExtension: false }\n )\n )\n )\n );\n } else {\n await Promise.all(\n Object.entries(result.files).map(async ([filePath, content]) =>\n this.fs.write(\n joinPaths(this.config.capnp.outputPath, filePath),\n content\n )\n )\n );\n }\n }\n };\n};\n\nexport default plugin;\n"],"mappings":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|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-capnp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.462",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A Powerlines plugin to generate project code from Cap'n Proto schemas.",
|
|
6
6
|
"repository": {
|
|
@@ -95,13 +95,13 @@
|
|
|
95
95
|
"@stryke/types": "^0.12.0",
|
|
96
96
|
"defu": "^6.1.7",
|
|
97
97
|
"jiti": "^2.6.1",
|
|
98
|
-
"powerlines": "^0.46.
|
|
98
|
+
"powerlines": "^0.46.6"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
101
|
+
"@powerlines/plugin-plugin": "^0.12.410",
|
|
102
102
|
"@types/node": "^25.6.0"
|
|
103
103
|
},
|
|
104
104
|
"publishConfig": { "access": "public" },
|
|
105
105
|
"types": "./dist/index.d.cts",
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "610c4c943933458c5f433b9002d8c187625b2d3f"
|
|
107
107
|
}
|