@powerlines/plugin-content-collections 0.1.221 → 0.1.223
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/helpers/create-writer.cjs +2 -2
- package/dist/helpers/create-writer.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +1 -1
- package/dist/powerlines/src/lib/utilities/file-header.cjs +13 -0
- package/dist/powerlines/src/lib/utilities/file-header.mjs +12 -0
- package/dist/powerlines/src/plugin-utils/paths.cjs +36 -0
- package/dist/powerlines/src/plugin-utils/paths.mjs +35 -0
- package/package.json +4 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_file_header = require('../powerlines/src/lib/utilities/file-header.cjs');
|
|
2
3
|
let __content_collections_core = require("@content-collections/core");
|
|
3
4
|
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
4
5
|
let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
5
6
|
let pluralize = require("pluralize");
|
|
6
7
|
pluralize = require_rolldown_runtime.__toESM(pluralize);
|
|
7
|
-
let powerlines_lib_utilities_file_header = require("powerlines/lib/utilities/file-header");
|
|
8
8
|
|
|
9
9
|
//#region src/helpers/create-writer.ts
|
|
10
10
|
const createConstName = (name) => {
|
|
@@ -21,7 +21,7 @@ const createArrayConstName = (name) => {
|
|
|
21
21
|
const createWriter = (context) => {
|
|
22
22
|
return {
|
|
23
23
|
createJavaScriptFile: async (configuration) => {
|
|
24
|
-
return context.emitBuiltin(`${
|
|
24
|
+
return context.emitBuiltin(`${require_file_header.getBaseFileHeader(context)}
|
|
25
25
|
${configuration.collections.map(({ name }) => `import ${createArrayConstName(name)} from "./${(0, __stryke_string_format_kebab_case.kebabCase)(name)}";`).join("\n")}
|
|
26
26
|
|
|
27
27
|
export { ${configuration.collections.map(({ name }) => createArrayConstName(name)).join(", ")} };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { getBaseFileHeader } from "../powerlines/src/lib/utilities/file-header.mjs";
|
|
1
2
|
import { serialize } from "@content-collections/core";
|
|
2
3
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
3
4
|
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
4
5
|
import pluralize from "pluralize";
|
|
5
|
-
import { getBaseFileHeader } from "powerlines/lib/utilities/file-header";
|
|
6
6
|
|
|
7
7
|
//#region src/helpers/create-writer.ts
|
|
8
8
|
const createConstName = (name) => {
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
+
const require_paths = require('./powerlines/src/plugin-utils/paths.cjs');
|
|
3
4
|
const require_helpers_create_emitter = require('./helpers/create-emitter.cjs');
|
|
4
5
|
const require_helpers_create_writer = require('./helpers/create-writer.cjs');
|
|
5
6
|
require('./helpers/index.cjs');
|
|
@@ -9,7 +10,6 @@ let __stryke_path_join = require("@stryke/path/join");
|
|
|
9
10
|
let defu = require("defu");
|
|
10
11
|
defu = require_rolldown_runtime.__toESM(defu);
|
|
11
12
|
let node_crypto = require("node:crypto");
|
|
12
|
-
let powerlines_plugin_utils_paths = require("powerlines/plugin-utils/paths");
|
|
13
13
|
|
|
14
14
|
//#region src/index.ts
|
|
15
15
|
/**
|
|
@@ -28,8 +28,8 @@ const plugin = (options) => {
|
|
|
28
28
|
}) };
|
|
29
29
|
},
|
|
30
30
|
async configResolved() {
|
|
31
|
-
this.config.contentCollections.configFile ||=
|
|
32
|
-
this.config.contentCollections.outputPath ||=
|
|
31
|
+
this.config.contentCollections.configFile ||= require_paths.replacePathTokens(this, this.config.contentCollections.configFile);
|
|
32
|
+
this.config.contentCollections.outputPath ||= require_paths.replacePathTokens(this, this.config.contentCollections.outputPath);
|
|
33
33
|
const emitter = require_helpers_create_emitter.createEmitter();
|
|
34
34
|
const readConfiguration = (0, __content_collections_core.createConfigurationReader)();
|
|
35
35
|
let configuration = {};
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { replacePathTokens } from "./powerlines/src/plugin-utils/paths.mjs";
|
|
1
2
|
import { createEmitter } from "./helpers/create-emitter.mjs";
|
|
2
3
|
import { createWriter } from "./helpers/create-writer.mjs";
|
|
3
4
|
import "./helpers/index.mjs";
|
|
@@ -6,7 +7,6 @@ import { existsSync } from "@stryke/fs/exists";
|
|
|
6
7
|
import { joinPaths } from "@stryke/path/join";
|
|
7
8
|
import defu from "defu";
|
|
8
9
|
import { createHash } from "node:crypto";
|
|
9
|
-
import { replacePathTokens } from "powerlines/plugin-utils/paths";
|
|
10
10
|
|
|
11
11
|
//#region src/index.ts
|
|
12
12
|
/**
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/lib/utilities/file-header.ts
|
|
5
|
+
function getBaseFileHeader(context) {
|
|
6
|
+
return `
|
|
7
|
+
// Generated with ${(0, __stryke_string_format_title_case.titleCase)(context.config.framework)}
|
|
8
|
+
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
9
|
+
`;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.getBaseFileHeader = getBaseFileHeader;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
2
|
+
|
|
3
|
+
//#region ../powerlines/src/lib/utilities/file-header.ts
|
|
4
|
+
function getBaseFileHeader(context) {
|
|
5
|
+
return `
|
|
6
|
+
// Generated with ${titleCase(context.config.framework)}
|
|
7
|
+
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
8
|
+
`;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { getBaseFileHeader };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __stryke_path_replace = require("@stryke/path/replace");
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/plugin-utils/paths.ts
|
|
5
|
+
/**
|
|
6
|
+
* Replaces tokens in the given path string with their corresponding values from the context.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* The following tokens are supported:
|
|
10
|
+
* - `{workspaceRoot}` - The root directory of the workspace.
|
|
11
|
+
* - `{root}` - The root directory of the project (same as `{projectRoot}`).
|
|
12
|
+
* - `{projectRoot}` - The root directory of the project (same as `{root}`).
|
|
13
|
+
* - `{sourceRoot}` - The source root directory of the project (usually `./src`).
|
|
14
|
+
* - `{powerlinesPath}` - The directory where Powerlines is installed.
|
|
15
|
+
* - `{cachePath}` - The environment's directory for cached files.
|
|
16
|
+
* - `{dataPath}` - The environment's directory for data files.
|
|
17
|
+
* - `{logPath}` - The environment's directory for log files.
|
|
18
|
+
* - `{tempPath}` - The environment's directory for temporary files.
|
|
19
|
+
* - `{configPath}` - The environment's directory for configuration files.
|
|
20
|
+
* - `{outputPath}` - The configured output directory for the project.
|
|
21
|
+
* - `{buildPath}` - The configured distribution directory for the project.
|
|
22
|
+
* - `{artifactsPath}` - The configured directory for build artifacts.
|
|
23
|
+
* - `{builtinPath}` - The configured directory for generated built-in plugins.
|
|
24
|
+
* - `{entryPath}` - The configured directory for generated entry files.
|
|
25
|
+
*
|
|
26
|
+
* @param context - The context containing the values for the path tokens.
|
|
27
|
+
* @param path - The path string with tokens to replace.
|
|
28
|
+
* @returns The path string with tokens replaced by their corresponding values from the context.
|
|
29
|
+
*/
|
|
30
|
+
function replacePathTokens(context, path) {
|
|
31
|
+
if (!path) return path;
|
|
32
|
+
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", (0, __stryke_path_replace.replacePath)(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", (0, __stryke_path_replace.replacePath)(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", (0, __stryke_path_replace.replacePath)(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.replacePathTokens = replacePathTokens;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { replacePath } from "@stryke/path/replace";
|
|
2
|
+
|
|
3
|
+
//#region ../powerlines/src/plugin-utils/paths.ts
|
|
4
|
+
/**
|
|
5
|
+
* Replaces tokens in the given path string with their corresponding values from the context.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* The following tokens are supported:
|
|
9
|
+
* - `{workspaceRoot}` - The root directory of the workspace.
|
|
10
|
+
* - `{root}` - The root directory of the project (same as `{projectRoot}`).
|
|
11
|
+
* - `{projectRoot}` - The root directory of the project (same as `{root}`).
|
|
12
|
+
* - `{sourceRoot}` - The source root directory of the project (usually `./src`).
|
|
13
|
+
* - `{powerlinesPath}` - The directory where Powerlines is installed.
|
|
14
|
+
* - `{cachePath}` - The environment's directory for cached files.
|
|
15
|
+
* - `{dataPath}` - The environment's directory for data files.
|
|
16
|
+
* - `{logPath}` - The environment's directory for log files.
|
|
17
|
+
* - `{tempPath}` - The environment's directory for temporary files.
|
|
18
|
+
* - `{configPath}` - The environment's directory for configuration files.
|
|
19
|
+
* - `{outputPath}` - The configured output directory for the project.
|
|
20
|
+
* - `{buildPath}` - The configured distribution directory for the project.
|
|
21
|
+
* - `{artifactsPath}` - The configured directory for build artifacts.
|
|
22
|
+
* - `{builtinPath}` - The configured directory for generated built-in plugins.
|
|
23
|
+
* - `{entryPath}` - The configured directory for generated entry files.
|
|
24
|
+
*
|
|
25
|
+
* @param context - The context containing the values for the path tokens.
|
|
26
|
+
* @param path - The path string with tokens to replace.
|
|
27
|
+
* @returns The path string with tokens replaced by their corresponding values from the context.
|
|
28
|
+
*/
|
|
29
|
+
function replacePathTokens(context, path) {
|
|
30
|
+
if (!path) return path;
|
|
31
|
+
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { replacePathTokens };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-content-collections",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.223",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A Powerlines plugin to generate project code using Content Collections.",
|
|
6
6
|
"repository": {
|
|
@@ -131,13 +131,13 @@
|
|
|
131
131
|
"@stryke/types": "^0.10.34",
|
|
132
132
|
"defu": "^6.1.4",
|
|
133
133
|
"pluralize": "^8.0.0",
|
|
134
|
-
"powerlines": "^0.37.
|
|
134
|
+
"powerlines": "^0.37.95"
|
|
135
135
|
},
|
|
136
136
|
"devDependencies": {
|
|
137
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
137
|
+
"@powerlines/plugin-plugin": "^0.12.174",
|
|
138
138
|
"@types/node": "^24.10.9",
|
|
139
139
|
"@types/pluralize": "^0.0.33"
|
|
140
140
|
},
|
|
141
141
|
"publishConfig": { "access": "public" },
|
|
142
|
-
"gitHead": "
|
|
142
|
+
"gitHead": "2852dab8ff7cad2d1aa4a44d7fd2479d62f65d47"
|
|
143
143
|
}
|