@powerlines/plugin-content-collections 0.1.290 → 0.1.292

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.
@@ -4,7 +4,7 @@ let pluralize = require("pluralize");
4
4
  pluralize = require_rolldown_runtime.__toESM(pluralize);
5
5
  let __stryke_path_join_paths = require("@stryke/path/join-paths");
6
6
  let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
7
- let powerlines_lib_utilities_file_header = require("powerlines/lib/utilities/file-header");
7
+ let powerlines_utils = require("powerlines/utils");
8
8
 
9
9
  //#region src/helpers/create-writer.ts
10
10
  const createConstName = (name) => {
@@ -14,14 +14,15 @@ const createArrayConstName = (name) => {
14
14
  return `all${createConstName(name)}`;
15
15
  };
16
16
  /**
17
+ * Creates a Writer instance for emitting files related to content collections.
17
18
  *
18
19
  * @param context - The Powerlines build plugin
19
- * @returns
20
+ * @returns A Writer instance for emitting files related to content collections
20
21
  */
21
22
  const createWriter = (context) => {
22
23
  return {
23
24
  createJavaScriptFile: async (configuration) => {
24
- return context.emitBuiltin(`${(0, powerlines_lib_utilities_file_header.getBaseFileHeader)(context)}
25
+ return context.emitBuiltin(`${(0, powerlines_utils.getBaseFileHeader)(context)}
25
26
  ${configuration.collections.map(({ name }) => `import ${createArrayConstName(name)} from "./${(0, __stryke_string_format_kebab_case.kebabCase)(name)}";`).join("\n")}
26
27
 
27
28
  export { ${configuration.collections.map(({ name }) => createArrayConstName(name)).join(", ")} };
@@ -4,9 +4,10 @@ import { Writer } from "@content-collections/core";
4
4
  //#region src/helpers/create-writer.d.ts
5
5
 
6
6
  /**
7
+ * Creates a Writer instance for emitting files related to content collections.
7
8
  *
8
9
  * @param context - The Powerlines build plugin
9
- * @returns
10
+ * @returns A Writer instance for emitting files related to content collections
10
11
  */
11
12
  declare const createWriter: (context: ContentCollectionsPluginContext) => Writer;
12
13
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"create-writer.d.cts","names":[],"sources":["../../src/helpers/create-writer.ts"],"sourcesContent":[],"mappings":";;;;;;;AA4CA;;;cAAa,wBACF,oCACR"}
1
+ {"version":3,"file":"create-writer.d.cts","names":[],"sources":["../../src/helpers/create-writer.ts"],"sourcesContent":[],"mappings":";;;;;;;AA6CA;;;;cAAa,wBACF,oCACR"}
@@ -4,9 +4,10 @@ import { Writer } from "@content-collections/core";
4
4
  //#region src/helpers/create-writer.d.ts
5
5
 
6
6
  /**
7
+ * Creates a Writer instance for emitting files related to content collections.
7
8
  *
8
9
  * @param context - The Powerlines build plugin
9
- * @returns
10
+ * @returns A Writer instance for emitting files related to content collections
10
11
  */
11
12
  declare const createWriter: (context: ContentCollectionsPluginContext) => Writer;
12
13
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"create-writer.d.mts","names":[],"sources":["../../src/helpers/create-writer.ts"],"sourcesContent":[],"mappings":";;;;;;;AA4CA;;;cAAa,wBACF,oCACR"}
1
+ {"version":3,"file":"create-writer.d.mts","names":[],"sources":["../../src/helpers/create-writer.ts"],"sourcesContent":[],"mappings":";;;;;;;AA6CA;;;;cAAa,wBACF,oCACR"}
@@ -2,7 +2,7 @@ import { serialize } from "../node_modules/.pnpm/@content-collections_core@0.12.
2
2
  import pluralize from "pluralize";
3
3
  import { joinPaths } from "@stryke/path/join-paths";
4
4
  import { kebabCase } from "@stryke/string-format/kebab-case";
5
- import { getBaseFileHeader } from "powerlines/lib/utilities/file-header";
5
+ import { getBaseFileHeader } from "powerlines/utils";
6
6
 
7
7
  //#region src/helpers/create-writer.ts
8
8
  const createConstName = (name) => {
@@ -12,9 +12,10 @@ const createArrayConstName = (name) => {
12
12
  return `all${createConstName(name)}`;
13
13
  };
14
14
  /**
15
+ * Creates a Writer instance for emitting files related to content collections.
15
16
  *
16
17
  * @param context - The Powerlines build plugin
17
- * @returns
18
+ * @returns A Writer instance for emitting files related to content collections
18
19
  */
19
20
  const createWriter = (context) => {
20
21
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"create-writer.mjs","names":[],"sources":["../../src/helpers/create-writer.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 {\n DataFileCollection,\n JavaScriptFileConfiguration,\n serialize,\n TypeDefinitionFileConfiguration,\n Writer\n} from \"@content-collections/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport pluralize from \"pluralize\";\nimport { getBaseFileHeader } from \"powerlines/lib/utilities/file-header\";\nimport { ContentCollectionsPluginContext } from \"../types/plugin\";\n\nconst createConstName = (name: string) => {\n return pluralize(name.charAt(0).toUpperCase() + name.slice(1));\n};\n\nconst createArrayConstName = (name: string) => {\n return `all${createConstName(name)}`;\n};\n\n/**\n *\n * @param context - The Powerlines build plugin\n * @returns\n */\nexport const createWriter = (\n context: ContentCollectionsPluginContext\n): Writer => {\n return {\n createJavaScriptFile: async (\n configuration: JavaScriptFileConfiguration\n ) => {\n return context.emitBuiltin(\n `${getBaseFileHeader(context)}\n${configuration.collections\n .map(\n ({ name }) =>\n `import ${createArrayConstName(name)} from \"./${kebabCase(name)}\";`\n )\n .join(\"\\n\")}\n\nexport { ${configuration.collections\n .map(({ name }) => createArrayConstName(name))\n .join(\", \")} };\n`,\n \"content\"\n );\n },\n createTypeDefinitionFile: async (_: TypeDefinitionFileConfiguration) =>\n Promise.resolve(),\n createDataFiles: async (collections: Array<DataFileCollection>) => {\n await Promise.all(\n collections.map(async collection => {\n if (context.config.contentCollections.outputPath) {\n return context.fs.write(\n joinPaths(\n context.config.contentCollections.outputPath,\n kebabCase(collection.name)\n ),\n serialize(collection.documents.map(doc => doc.document))\n );\n }\n\n return context.emitBuiltin(\n serialize(collection.documents.map(doc => doc.document)),\n joinPaths(\"content\", kebabCase(collection.name))\n );\n })\n );\n }\n };\n};\n"],"mappings":";;;;;;;AA+BA,MAAM,mBAAmB,SAAiB;AACxC,QAAO,UAAU,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE,CAAC;;AAGhE,MAAM,wBAAwB,SAAiB;AAC7C,QAAO,MAAM,gBAAgB,KAAK;;;;;;;AAQpC,MAAa,gBACX,YACW;AACX,QAAO;EACL,sBAAsB,OACpB,kBACG;AACH,UAAO,QAAQ,YACb,GAAG,kBAAkB,QAAQ,CAAC;EACpC,cAAc,YACb,KACE,EAAE,WACD,UAAU,qBAAqB,KAAK,CAAC,WAAW,UAAU,KAAK,CAAC,IACnE,CACA,KAAK,KAAK,CAAC;;WAEH,cAAc,YACd,KAAK,EAAE,WAAW,qBAAqB,KAAK,CAAC,CAC7C,KAAK,KAAK,CAAC;GAEd,UACD;;EAEH,0BAA0B,OAAO,MAC/B,QAAQ,SAAS;EACnB,iBAAiB,OAAO,gBAA2C;AACjE,SAAM,QAAQ,IACZ,YAAY,IAAI,OAAM,eAAc;AAClC,QAAI,QAAQ,OAAO,mBAAmB,WACpC,QAAO,QAAQ,GAAG,MAChB,UACE,QAAQ,OAAO,mBAAmB,YAClC,UAAU,WAAW,KAAK,CAC3B,EACD,UAAU,WAAW,UAAU,KAAI,QAAO,IAAI,SAAS,CAAC,CACzD;AAGH,WAAO,QAAQ,YACb,UAAU,WAAW,UAAU,KAAI,QAAO,IAAI,SAAS,CAAC,EACxD,UAAU,WAAW,UAAU,WAAW,KAAK,CAAC,CACjD;KACD,CACH;;EAEJ"}
1
+ {"version":3,"file":"create-writer.mjs","names":[],"sources":["../../src/helpers/create-writer.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 {\n DataFileCollection,\n JavaScriptFileConfiguration,\n serialize,\n TypeDefinitionFileConfiguration,\n Writer\n} from \"@content-collections/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport pluralize from \"pluralize\";\nimport { getBaseFileHeader } from \"powerlines/utils\";\nimport { ContentCollectionsPluginContext } from \"../types/plugin\";\n\nconst createConstName = (name: string) => {\n return pluralize(name.charAt(0).toUpperCase() + name.slice(1));\n};\n\nconst createArrayConstName = (name: string) => {\n return `all${createConstName(name)}`;\n};\n\n/**\n * Creates a Writer instance for emitting files related to content collections.\n *\n * @param context - The Powerlines build plugin\n * @returns A Writer instance for emitting files related to content collections\n */\nexport const createWriter = (\n context: ContentCollectionsPluginContext\n): Writer => {\n return {\n createJavaScriptFile: async (\n configuration: JavaScriptFileConfiguration\n ) => {\n return context.emitBuiltin(\n `${getBaseFileHeader(context)}\n${configuration.collections\n .map(\n ({ name }) =>\n `import ${createArrayConstName(name)} from \"./${kebabCase(name)}\";`\n )\n .join(\"\\n\")}\n\nexport { ${configuration.collections\n .map(({ name }) => createArrayConstName(name))\n .join(\", \")} };\n`,\n \"content\"\n );\n },\n createTypeDefinitionFile: async (_: TypeDefinitionFileConfiguration) =>\n Promise.resolve(),\n createDataFiles: async (collections: Array<DataFileCollection>) => {\n await Promise.all(\n collections.map(async collection => {\n if (context.config.contentCollections.outputPath) {\n return context.fs.write(\n joinPaths(\n context.config.contentCollections.outputPath,\n kebabCase(collection.name)\n ),\n serialize(collection.documents.map(doc => doc.document))\n );\n }\n\n return context.emitBuiltin(\n serialize(collection.documents.map(doc => doc.document)),\n joinPaths(\"content\", kebabCase(collection.name))\n );\n })\n );\n }\n };\n};\n"],"mappings":";;;;;;;AA+BA,MAAM,mBAAmB,SAAiB;AACxC,QAAO,UAAU,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE,CAAC;;AAGhE,MAAM,wBAAwB,SAAiB;AAC7C,QAAO,MAAM,gBAAgB,KAAK;;;;;;;;AASpC,MAAa,gBACX,YACW;AACX,QAAO;EACL,sBAAsB,OACpB,kBACG;AACH,UAAO,QAAQ,YACb,GAAG,kBAAkB,QAAQ,CAAC;EACpC,cAAc,YACb,KACE,EAAE,WACD,UAAU,qBAAqB,KAAK,CAAC,WAAW,UAAU,KAAK,CAAC,IACnE,CACA,KAAK,KAAK,CAAC;;WAEH,cAAc,YACd,KAAK,EAAE,WAAW,qBAAqB,KAAK,CAAC,CAC7C,KAAK,KAAK,CAAC;GAEd,UACD;;EAEH,0BAA0B,OAAO,MAC/B,QAAQ,SAAS;EACnB,iBAAiB,OAAO,gBAA2C;AACjE,SAAM,QAAQ,IACZ,YAAY,IAAI,OAAM,eAAc;AAClC,QAAI,QAAQ,OAAO,mBAAmB,WACpC,QAAO,QAAQ,GAAG,MAChB,UACE,QAAQ,OAAO,mBAAmB,YAClC,UAAU,WAAW,KAAK,CAC3B,EACD,UAAU,WAAW,UAAU,KAAI,QAAO,IAAI,SAAS,CAAC,CACzD;AAGH,WAAO,QAAQ,YACb,UAAU,WAAW,UAAU,KAAI,QAAO,IAAI,SAAS,CAAC,EACxD,UAAU,WAAW,UAAU,WAAW,KAAK,CAAC,CACjD;KACD,CACH;;EAEJ"}
package/dist/index.cjs CHANGED
@@ -9,7 +9,7 @@ let __stryke_fs_exists = require("@stryke/fs/exists");
9
9
  let __stryke_path_join = require("@stryke/path/join");
10
10
  let defu = require("defu");
11
11
  defu = require_rolldown_runtime.__toESM(defu);
12
- let powerlines_plugin_utils_paths = require("powerlines/plugin-utils/paths");
12
+ let powerlines_plugin_utils = require("powerlines/plugin-utils");
13
13
 
14
14
  //#region src/index.ts
15
15
  /**
@@ -23,13 +23,13 @@ const plugin = (options) => {
23
23
  name: "content-collections",
24
24
  config() {
25
25
  return { contentCollections: (0, defu.default)(options, {
26
- configFile: "{projectRoot}/content-collections.ts",
26
+ configFile: "{root}/content-collections.ts",
27
27
  collections: []
28
28
  }) };
29
29
  },
30
30
  async configResolved() {
31
- this.config.contentCollections.configFile ||= (0, powerlines_plugin_utils_paths.replacePathTokens)(this, this.config.contentCollections.configFile);
32
- this.config.contentCollections.outputPath ||= (0, powerlines_plugin_utils_paths.replacePathTokens)(this, this.config.contentCollections.outputPath);
31
+ this.config.contentCollections.configFile ||= (0, powerlines_plugin_utils.replacePathTokens)(this, this.config.contentCollections.configFile);
32
+ this.config.contentCollections.outputPath ||= (0, powerlines_plugin_utils.replacePathTokens)(this, this.config.contentCollections.outputPath);
33
33
  const emitter = require_helpers_create_emitter.createEmitter();
34
34
  const readConfiguration = require_index.createConfigurationReader();
35
35
  let configuration = {};
@@ -43,7 +43,7 @@ const plugin = (options) => {
43
43
  configuration.checksum = (0, node_crypto.createHash)("sha256").update(JSON.stringify(configuration)).digest("hex");
44
44
  const context = await require_index.createBuildContext({
45
45
  emitter,
46
- baseDirectory: (0, __stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot),
46
+ baseDirectory: (0, __stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.root),
47
47
  outputDirectory: this.config.contentCollections.outputPath || (0, __stryke_path_join.joinPaths)(this.builtinsPath, "content"),
48
48
  configuration
49
49
  });
package/dist/index.d.cts CHANGED
@@ -3,10 +3,14 @@ import { ContentCollectionsContext, ContentCollectionsPluginContext, ContentColl
3
3
  import { createWriter } from "./helpers/create-writer.cjs";
4
4
  import "./helpers/index.cjs";
5
5
  import "./types/index.cjs";
6
- import { Plugin } from "powerlines/types/plugin";
6
+ import { Plugin } from "powerlines";
7
7
 
8
8
  //#region src/index.d.ts
9
-
9
+ declare module "powerlines" {
10
+ interface UserConfig {
11
+ contentCollections?: ContentCollectionsPluginOptions;
12
+ }
13
+ }
10
14
  /**
11
15
  * A Powerlines plugin to integrate Content Collections for code generation.
12
16
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;AA+CA;;AAEI,cAFS,MAET,EAAA,CAAA,iBADe,+BACf,GAAA,+BAAA,CAAA,CAAA,OAAA,EAEO,+BAFP,EAAA,GAGD,MAHC,CAGM,QAHN,CAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;yBA2CyB;;AAJD;;;;;AAcxB;;AAEI,cAFS,MAET,EAAA,CAAA,iBADe,+BACf,GAAA,+BAAA,CAAA,CAAA,OAAA,EAEO,+BAFP,EAAA,GAGD,MAHC,CAGM,QAHN,CAAA"}
package/dist/index.d.mts CHANGED
@@ -3,10 +3,14 @@ import { ContentCollectionsContext, ContentCollectionsPluginContext, ContentColl
3
3
  import { createWriter } from "./helpers/create-writer.mjs";
4
4
  import "./helpers/index.mjs";
5
5
  import "./types/index.mjs";
6
- import { Plugin } from "powerlines/types/plugin";
6
+ import { Plugin } from "powerlines";
7
7
 
8
8
  //#region src/index.d.ts
9
-
9
+ declare module "powerlines" {
10
+ interface UserConfig {
11
+ contentCollections?: ContentCollectionsPluginOptions;
12
+ }
13
+ }
10
14
  /**
11
15
  * A Powerlines plugin to integrate Content Collections for code generation.
12
16
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;AA+CA;;AAEI,cAFS,MAET,EAAA,CAAA,iBADe,+BACf,GAAA,+BAAA,CAAA,CAAA,OAAA,EAEO,+BAFP,EAAA,GAGD,MAHC,CAGM,QAHN,CAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;yBA2CyB;;AAJD;;;;;AAcxB;;AAEI,cAFS,MAET,EAAA,CAAA,iBADe,+BACf,GAAA,+BAAA,CAAA,CAAA,OAAA,EAEO,+BAFP,EAAA,GAGD,MAHC,CAGM,QAHN,CAAA"}
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import { createHash } from "node:crypto";
6
6
  import { existsSync } from "@stryke/fs/exists";
7
7
  import { joinPaths } from "@stryke/path/join";
8
8
  import defu from "defu";
9
- import { replacePathTokens } from "powerlines/plugin-utils/paths";
9
+ import { replacePathTokens } from "powerlines/plugin-utils";
10
10
 
11
11
  //#region src/index.ts
12
12
  /**
@@ -20,7 +20,7 @@ const plugin = (options) => {
20
20
  name: "content-collections",
21
21
  config() {
22
22
  return { contentCollections: defu(options, {
23
- configFile: "{projectRoot}/content-collections.ts",
23
+ configFile: "{root}/content-collections.ts",
24
24
  collections: []
25
25
  }) };
26
26
  },
@@ -40,7 +40,7 @@ const plugin = (options) => {
40
40
  configuration.checksum = createHash("sha256").update(JSON.stringify(configuration)).digest("hex");
41
41
  const context = await createBuildContext({
42
42
  emitter,
43
- baseDirectory: joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot),
43
+ baseDirectory: joinPaths(this.workspaceConfig.workspaceRoot, this.config.root),
44
44
  outputDirectory: this.config.contentCollections.outputPath || joinPaths(this.builtinsPath, "content"),
45
45
  configuration
46
46
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["build"],"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 {\n build,\n createBuildContext,\n createConfigurationReader,\n InternalConfiguration\n} from \"@content-collections/core\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport defu from \"defu\";\nimport { createHash } from \"node:crypto\";\nimport { replacePathTokens } from \"powerlines/plugin-utils/paths\";\nimport { Plugin } from \"powerlines/types/plugin\";\nimport { createEmitter } from \"./helpers/create-emitter\";\nimport { createWriter } from \"./helpers/create-writer\";\nimport {\n ContentCollectionsPluginContext,\n ContentCollectionsPluginOptions,\n ContentCollectionsPluginUserConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\n/**\n * A Powerlines plugin to integrate Content Collections for code generation.\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends ContentCollectionsPluginContext =\n ContentCollectionsPluginContext\n>(\n options: ContentCollectionsPluginOptions\n): Plugin<TContext> => {\n return {\n name: \"content-collections\",\n config() {\n return {\n contentCollections: defu(options, {\n configFile: \"{projectRoot}/content-collections.ts\",\n collections: []\n })\n } as Partial<ContentCollectionsPluginUserConfig>;\n },\n async configResolved() {\n this.config.contentCollections.configFile ||= replacePathTokens(\n this,\n this.config.contentCollections.configFile\n );\n\n this.config.contentCollections.outputPath ||= replacePathTokens(\n this,\n this.config.contentCollections.outputPath\n );\n\n const emitter = createEmitter();\n const readConfiguration = createConfigurationReader();\n\n let configuration = {} as InternalConfiguration;\n try {\n if (existsSync(this.config.contentCollections.configFile)) {\n configuration = await readConfiguration(\n this.config.contentCollections.configFile,\n {\n configName: \"config.mjs\",\n cacheDir: joinPaths(this.cachePath, \"content-collections\")\n }\n );\n }\n } catch {\n // Do nothing\n }\n\n configuration = defu(configuration ?? {}, this.config.contentCollections);\n configuration.checksum = createHash(\"sha256\")\n .update(JSON.stringify(configuration))\n .digest(\"hex\");\n\n const context = await createBuildContext({\n emitter,\n baseDirectory: joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.projectRoot\n ),\n outputDirectory:\n this.config.contentCollections.outputPath ||\n joinPaths(this.builtinsPath, \"content\"),\n configuration\n });\n context.writer = createWriter(this);\n\n this.contentCollections = {\n context,\n build: async () => build(context),\n on: emitter.on\n };\n },\n async prepare() {\n return this.contentCollections.build();\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;AA+CA,MAAa,UAIX,YACqB;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO,EACL,oBAAoB,KAAK,SAAS;IAChC,YAAY;IACZ,aAAa,EAAE;IAChB,CAAC,EACH;;EAEH,MAAM,iBAAiB;AACrB,QAAK,OAAO,mBAAmB,eAAe,kBAC5C,MACA,KAAK,OAAO,mBAAmB,WAChC;AAED,QAAK,OAAO,mBAAmB,eAAe,kBAC5C,MACA,KAAK,OAAO,mBAAmB,WAChC;GAED,MAAM,UAAU,eAAe;GAC/B,MAAM,oBAAoB,2BAA2B;GAErD,IAAI,gBAAgB,EAAE;AACtB,OAAI;AACF,QAAI,WAAW,KAAK,OAAO,mBAAmB,WAAW,CACvD,iBAAgB,MAAM,kBACpB,KAAK,OAAO,mBAAmB,YAC/B;KACE,YAAY;KACZ,UAAU,UAAU,KAAK,WAAW,sBAAsB;KAC3D,CACF;WAEG;AAIR,mBAAgB,KAAK,iBAAiB,EAAE,EAAE,KAAK,OAAO,mBAAmB;AACzE,iBAAc,WAAW,WAAW,SAAS,CAC1C,OAAO,KAAK,UAAU,cAAc,CAAC,CACrC,OAAO,MAAM;GAEhB,MAAM,UAAU,MAAM,mBAAmB;IACvC;IACA,eAAe,UACb,KAAK,gBAAgB,eACrB,KAAK,OAAO,YACb;IACD,iBACE,KAAK,OAAO,mBAAmB,cAC/B,UAAU,KAAK,cAAc,UAAU;IACzC;IACD,CAAC;AACF,WAAQ,SAAS,aAAa,KAAK;AAEnC,QAAK,qBAAqB;IACxB;IACA,OAAO,YAAYA,QAAM,QAAQ;IACjC,IAAI,QAAQ;IACb;;EAEH,MAAM,UAAU;AACd,UAAO,KAAK,mBAAmB,OAAO;;EAEzC;;AAGH,kBAAe"}
1
+ {"version":3,"file":"index.mjs","names":["build"],"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 {\n build,\n createBuildContext,\n createConfigurationReader,\n InternalConfiguration\n} from \"@content-collections/core\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport defu from \"defu\";\nimport { createHash } from \"node:crypto\";\nimport { Plugin } from \"powerlines\";\nimport { replacePathTokens } from \"powerlines/plugin-utils\";\nimport { createEmitter } from \"./helpers/create-emitter\";\nimport { createWriter } from \"./helpers/create-writer\";\nimport {\n ContentCollectionsPluginContext,\n ContentCollectionsPluginOptions,\n ContentCollectionsPluginUserConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n export interface UserConfig {\n contentCollections?: ContentCollectionsPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to integrate Content Collections for code generation.\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends ContentCollectionsPluginContext =\n ContentCollectionsPluginContext\n>(\n options: ContentCollectionsPluginOptions\n): Plugin<TContext> => {\n return {\n name: \"content-collections\",\n config() {\n return {\n contentCollections: defu(options, {\n configFile: \"{root}/content-collections.ts\",\n collections: []\n })\n } as Partial<ContentCollectionsPluginUserConfig>;\n },\n async configResolved() {\n this.config.contentCollections.configFile ||= replacePathTokens(\n this,\n this.config.contentCollections.configFile\n );\n\n this.config.contentCollections.outputPath ||= replacePathTokens(\n this,\n this.config.contentCollections.outputPath\n );\n\n const emitter = createEmitter();\n const readConfiguration = createConfigurationReader();\n\n let configuration = {} as InternalConfiguration;\n try {\n if (existsSync(this.config.contentCollections.configFile)) {\n configuration = await readConfiguration(\n this.config.contentCollections.configFile,\n {\n configName: \"config.mjs\",\n cacheDir: joinPaths(this.cachePath, \"content-collections\")\n }\n );\n }\n } catch {\n // Do nothing\n }\n\n configuration = defu(configuration ?? {}, this.config.contentCollections);\n configuration.checksum = createHash(\"sha256\")\n .update(JSON.stringify(configuration))\n .digest(\"hex\");\n\n const context = await createBuildContext({\n emitter,\n baseDirectory: joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.root\n ),\n outputDirectory:\n this.config.contentCollections.outputPath ||\n joinPaths(this.builtinsPath, \"content\"),\n configuration\n });\n context.writer = createWriter(this);\n\n this.contentCollections = {\n context,\n build: async () => build(context),\n on: emitter.on\n };\n },\n async prepare() {\n return this.contentCollections.build();\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;AAqDA,MAAa,UAIX,YACqB;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO,EACL,oBAAoB,KAAK,SAAS;IAChC,YAAY;IACZ,aAAa,EAAE;IAChB,CAAC,EACH;;EAEH,MAAM,iBAAiB;AACrB,QAAK,OAAO,mBAAmB,eAAe,kBAC5C,MACA,KAAK,OAAO,mBAAmB,WAChC;AAED,QAAK,OAAO,mBAAmB,eAAe,kBAC5C,MACA,KAAK,OAAO,mBAAmB,WAChC;GAED,MAAM,UAAU,eAAe;GAC/B,MAAM,oBAAoB,2BAA2B;GAErD,IAAI,gBAAgB,EAAE;AACtB,OAAI;AACF,QAAI,WAAW,KAAK,OAAO,mBAAmB,WAAW,CACvD,iBAAgB,MAAM,kBACpB,KAAK,OAAO,mBAAmB,YAC/B;KACE,YAAY;KACZ,UAAU,UAAU,KAAK,WAAW,sBAAsB;KAC3D,CACF;WAEG;AAIR,mBAAgB,KAAK,iBAAiB,EAAE,EAAE,KAAK,OAAO,mBAAmB;AACzE,iBAAc,WAAW,WAAW,SAAS,CAC1C,OAAO,KAAK,UAAU,cAAc,CAAC,CACrC,OAAO,MAAM;GAEhB,MAAM,UAAU,MAAM,mBAAmB;IACvC;IACA,eAAe,UACb,KAAK,gBAAgB,eACrB,KAAK,OAAO,KACb;IACD,iBACE,KAAK,OAAO,mBAAmB,cAC/B,UAAU,KAAK,cAAc,UAAU;IACzC;IACD,CAAC;AACF,WAAQ,SAAS,aAAa,KAAK;AAEnC,QAAK,qBAAqB;IACxB;IACA,OAAO,YAAYA,QAAM,QAAQ;IACjC,IAAI,QAAQ;IACb;;EAEH,MAAM,UAAU;AACd,UAAO,KAAK,mBAAmB,OAAO;;EAEzC;;AAGH,kBAAe"}
@@ -1,7 +1,5 @@
1
1
  import { AnyCollection, BuildContext, createInternalBuilder } from "@content-collections/core";
2
- import { UserConfig } from "powerlines/types/config";
3
- import { PluginContext } from "powerlines/types/context";
4
- import { ResolvedConfig } from "powerlines/types/resolved";
2
+ import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
5
3
 
6
4
  //#region src/types/plugin.d.ts
7
5
  type ContentCollectionsContext = Pick<Awaited<ReturnType<typeof createInternalBuilder>>, "build" | "on"> & {
@@ -12,9 +10,9 @@ interface ContentCollectionsPluginOptions {
12
10
  * The path to a custom Prisma configuration file.
13
11
  *
14
12
  * @remarks
15
- * This field allows the use of the "\{projectRoot\}" token to refer to the project's root directory - the value will be replaced with the correct file path by the plugin.
13
+ * This field allows the use of the "\{root\}" token to refer to the project's root directory - the value will be replaced with the correct file path by the plugin.
16
14
  *
17
- * @defaultValue "\{projectRoot\}/content-collections.ts"
15
+ * @defaultValue "\{root\}/content-collections.ts"
18
16
  */
19
17
  configFile?: string;
20
18
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;KA2BY,yBAAA,GAA4B,KACtC,QAAQ,kBAAkB;WAEb;AAHf,CAAA;AAC4B,UAIX,+BAAA,CAJW;EAAlB;;;;;AAIV;AA2BA;AAIA;EAAqD,UAAA,CAAA,EAAA,MAAA;EAE5C;;;EAEA,WAAA,CAAA,EArBO,aAqBP,EAAA;EAAL;;AAGJ;;;;;;EAI+C,UAAA,CAAA,EAAA,MAAA;;KAfnC,kCAAA,GAAqC;uBAC1B;;KAGX,sCAAA,GAAyC;sBAC/B,SAClB,KAAK,kDAEL,KAAK;;KAGG,wDAER,yCAAyC,0CACzC,cAAc;sBACI"}
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;KAyBY,yBAAA,GAA4B,KACtC,QAAQ,kBAAkB;WAEb;AAHf,CAAA;AAC4B,UAIX,+BAAA,CAJW;EAAlB;;;;;AAIV;AA2BA;AAIA;EAAqD,UAAA,CAAA,EAAA,MAAA;EAE5C;;;EAEA,WAAA,CAAA,EArBO,aAqBP,EAAA;EAAL;;AAGJ;;;;;;EAI+C,UAAA,CAAA,EAAA,MAAA;;KAfnC,kCAAA,GAAqC;uBAC1B;;KAGX,sCAAA,GAAyC;sBAC/B,SAClB,KAAK,kDAEL,KAAK;;KAGG,wDACc,yCACtB,0CACA,cAAc;sBACI"}
@@ -1,7 +1,5 @@
1
1
  import { AnyCollection, BuildContext, createInternalBuilder } from "@content-collections/core";
2
- import { UserConfig } from "powerlines/types/config";
3
- import { PluginContext } from "powerlines/types/context";
4
- import { ResolvedConfig } from "powerlines/types/resolved";
2
+ import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
5
3
 
6
4
  //#region src/types/plugin.d.ts
7
5
  type ContentCollectionsContext = Pick<Awaited<ReturnType<typeof createInternalBuilder>>, "build" | "on"> & {
@@ -12,9 +10,9 @@ interface ContentCollectionsPluginOptions {
12
10
  * The path to a custom Prisma configuration file.
13
11
  *
14
12
  * @remarks
15
- * This field allows the use of the "\{projectRoot\}" token to refer to the project's root directory - the value will be replaced with the correct file path by the plugin.
13
+ * This field allows the use of the "\{root\}" token to refer to the project's root directory - the value will be replaced with the correct file path by the plugin.
16
14
  *
17
- * @defaultValue "\{projectRoot\}/content-collections.ts"
15
+ * @defaultValue "\{root\}/content-collections.ts"
18
16
  */
19
17
  configFile?: string;
20
18
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;KA2BY,yBAAA,GAA4B,KACtC,QAAQ,kBAAkB;WAEb;AAHf,CAAA;AAC4B,UAIX,+BAAA,CAJW;EAAlB;;;;;AAIV;AA2BA;AAIA;EAAqD,UAAA,CAAA,EAAA,MAAA;EAE5C;;;EAEA,WAAA,CAAA,EArBO,aAqBP,EAAA;EAAL;;AAGJ;;;;;;EAI+C,UAAA,CAAA,EAAA,MAAA;;KAfnC,kCAAA,GAAqC;uBAC1B;;KAGX,sCAAA,GAAyC;sBAC/B,SAClB,KAAK,kDAEL,KAAK;;KAGG,wDAER,yCAAyC,0CACzC,cAAc;sBACI"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;KAyBY,yBAAA,GAA4B,KACtC,QAAQ,kBAAkB;WAEb;AAHf,CAAA;AAC4B,UAIX,+BAAA,CAJW;EAAlB;;;;;AAIV;AA2BA;AAIA;EAAqD,UAAA,CAAA,EAAA,MAAA;EAE5C;;;EAEA,WAAA,CAAA,EArBO,aAqBP,EAAA;EAAL;;AAGJ;;;;;;EAI+C,UAAA,CAAA,EAAA,MAAA;;KAfnC,kCAAA,GAAqC;uBAC1B;;KAGX,sCAAA,GAAyC;sBAC/B,SAClB,KAAK,kDAEL,KAAK;;KAGG,wDACc,yCACtB,0CACA,cAAc;sBACI"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-content-collections",
3
- "version": "0.1.290",
3
+ "version": "0.1.292",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin to generate project code using Content Collections.",
6
6
  "repository": {
@@ -55,6 +55,7 @@
55
55
  "default": "./dist/index.mjs"
56
56
  }
57
57
  },
58
+ "./*": "./*",
58
59
  "./helpers": {
59
60
  "require": {
60
61
  "types": "./dist/helpers/index.d.cts",
@@ -97,7 +98,6 @@
97
98
  "default": "./dist/helpers/create-writer.mjs"
98
99
  }
99
100
  },
100
- "./package.json": "./package.json",
101
101
  "./types": {
102
102
  "require": {
103
103
  "types": "./dist/types/index.d.cts",
@@ -145,14 +145,14 @@
145
145
  "@stryke/types": "^0.10.39",
146
146
  "defu": "^6.1.4",
147
147
  "pluralize": "^8.0.0",
148
- "powerlines": "^0.38.57"
148
+ "powerlines": "^0.39.1"
149
149
  },
150
150
  "devDependencies": {
151
- "@powerlines/plugin-plugin": "^0.12.241",
152
- "@types/node": "^25.3.1",
151
+ "@powerlines/plugin-plugin": "^0.12.243",
152
+ "@types/node": "^25.3.3",
153
153
  "@types/pluralize": "^0.0.33"
154
154
  },
155
155
  "publishConfig": { "access": "public" },
156
156
  "types": "./dist/index.d.cts",
157
- "gitHead": "eb3dbd19bd153aa5a988bce09a1cf05d985cb04b"
157
+ "gitHead": "30a096fed42d3462dbc028b16145250c373f3d99"
158
158
  }