@powerlines/plugin-content-collections 0.1.253 → 0.1.254

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.
Files changed (63) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  2. package/dist/helpers/create-emitter.cjs +32 -2
  3. package/dist/helpers/create-emitter.d.cts +30 -2
  4. package/dist/helpers/create-emitter.d.cts.map +1 -0
  5. package/dist/helpers/create-emitter.d.mts +30 -2
  6. package/dist/helpers/create-emitter.d.mts.map +1 -0
  7. package/dist/helpers/create-emitter.mjs +32 -2
  8. package/dist/helpers/create-emitter.mjs.map +1 -0
  9. package/dist/helpers/create-writer.cjs +40 -2
  10. package/dist/helpers/create-writer.d.cts +14 -3
  11. package/dist/helpers/create-writer.d.cts.map +1 -0
  12. package/dist/helpers/create-writer.d.mts +14 -3
  13. package/dist/helpers/create-writer.d.mts.map +1 -0
  14. package/dist/helpers/create-writer.mjs +39 -2
  15. package/dist/helpers/create-writer.mjs.map +1 -0
  16. package/dist/helpers/index.cjs +4 -5
  17. package/dist/helpers/index.d.cts +2 -4
  18. package/dist/helpers/index.d.mts +2 -4
  19. package/dist/helpers/index.mjs +2 -3
  20. package/dist/index.cjs +9 -10
  21. package/dist/index.d.cts +5 -5
  22. package/dist/index.d.mts +5 -5
  23. package/dist/index.mjs +3 -5
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/types/index.cjs +0 -2
  26. package/dist/types/index.d.cts +1 -2
  27. package/dist/types/index.d.mts +1 -2
  28. package/dist/types/index.mjs +0 -3
  29. package/dist/types/plugin.cjs +0 -1
  30. package/dist/types/plugin.d.cts +50 -2
  31. package/dist/types/plugin.d.cts.map +1 -0
  32. package/dist/types/plugin.d.mts +50 -2
  33. package/dist/types/plugin.d.mts.map +1 -0
  34. package/dist/types/plugin.mjs +0 -2
  35. package/package.json +4 -4
  36. package/dist/create-emitter-9FUdmUDk.cjs +0 -38
  37. package/dist/create-emitter-Bk1iruR0.d.cts +0 -30
  38. package/dist/create-emitter-Bk1iruR0.d.cts.map +0 -1
  39. package/dist/create-emitter-Ccqc-tkP.d.mts +0 -30
  40. package/dist/create-emitter-Ccqc-tkP.d.mts.map +0 -1
  41. package/dist/create-emitter-CdX9SXDY.mjs +0 -33
  42. package/dist/create-emitter-CdX9SXDY.mjs.map +0 -1
  43. package/dist/create-writer-B1kiqShf.d.mts +0 -14
  44. package/dist/create-writer-B1kiqShf.d.mts.map +0 -1
  45. package/dist/create-writer-B2z350kr.cjs +0 -78
  46. package/dist/create-writer-Bt5X22V1.d.cts +0 -14
  47. package/dist/create-writer-Bt5X22V1.d.cts.map +0 -1
  48. package/dist/create-writer-CCVVT4dm.mjs +0 -40
  49. package/dist/create-writer-CCVVT4dm.mjs.map +0 -1
  50. package/dist/helpers-y2jvHwgF.mjs +0 -1
  51. package/dist/helpers-yB1XkvQI.cjs +0 -0
  52. package/dist/index-BL32-cvv.d.cts +0 -1
  53. package/dist/index-BR1oNnaF.d.cts +0 -1
  54. package/dist/index-Bk0eNZmQ.d.mts +0 -1
  55. package/dist/index-DNLi60D-.d.mts +0 -1
  56. package/dist/plugin-B0q2kj8i.mjs +0 -1
  57. package/dist/plugin-B8NELjmq.d.mts +0 -50
  58. package/dist/plugin-B8NELjmq.d.mts.map +0 -1
  59. package/dist/plugin-Ckx8qAq8.cjs +0 -0
  60. package/dist/plugin-sUSM5ZDl.d.cts +0 -50
  61. package/dist/plugin-sUSM5ZDl.d.cts.map +0 -1
  62. package/dist/types--fVOUYBq.mjs +0 -1
  63. package/dist/types-a8gm_IaQ.cjs +0 -0
@@ -0,0 +1,29 @@
1
+ //#region rolldown:runtime
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;
@@ -1,3 +1,33 @@
1
- const require_create_emitter = require('../create-emitter-9FUdmUDk.cjs');
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let node_events = require("node:events");
2
3
 
3
- exports.createEmitter = require_create_emitter.createEmitter;
4
+ //#region src/helpers/create-emitter.ts
5
+ /**
6
+ * Create an event emitter with typed events.
7
+ *
8
+ * @returns An event emitter instance with typed event handling.
9
+ */
10
+ function createEmitter() {
11
+ const emitter = new node_events.EventEmitter();
12
+ function on(key, listener) {
13
+ emitter.on(key, listener);
14
+ }
15
+ function emit(key, event) {
16
+ emitter.emit(key, event);
17
+ if (typeof event === "object" && event !== null && "error" in event) emitter.emit("_error", {
18
+ ...event,
19
+ _event: key
20
+ });
21
+ emitter.emit("_all", {
22
+ ...event,
23
+ _event: key
24
+ });
25
+ }
26
+ return {
27
+ on,
28
+ emit
29
+ };
30
+ }
31
+
32
+ //#endregion
33
+ exports.createEmitter = createEmitter;
@@ -1,2 +1,30 @@
1
- import { t as createEmitter } from "../create-emitter-Bk1iruR0.cjs";
2
- export { createEmitter };
1
+ //#region src/helpers/create-emitter.d.ts
2
+ type EventMap = Record<string, object>;
3
+ interface EventWithError {
4
+ error: Error;
5
+ }
6
+ interface SystemEvent {
7
+ _event: string;
8
+ }
9
+ type ErrorEvent = EventWithError & SystemEvent;
10
+ interface SystemEvents extends EventMap {
11
+ _error: ErrorEvent;
12
+ _all: SystemEvent;
13
+ }
14
+ type Keys<TEvents extends EventMap> = keyof TEvents & string;
15
+ type Listener<TEvent> = (event: TEvent) => void;
16
+ /**
17
+ * Create an event emitter with typed events.
18
+ *
19
+ * @returns An event emitter instance with typed event handling.
20
+ */
21
+ declare function createEmitter<TEvents extends EventMap>(): {
22
+ on: {
23
+ <TKey extends Keys<TEvents>>(key: TKey, listener: Listener<TEvents[TKey]>): void;
24
+ <TKey extends Keys<SystemEvents>>(key: TKey, listener: Listener<SystemEvents[TKey]>): void;
25
+ };
26
+ emit: <TKey extends Keys<TEvents>>(key: TKey, event: TEvents[TKey]) => void;
27
+ };
28
+ //#endregion
29
+ export { createEmitter };
30
+ //# sourceMappingURL=create-emitter.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-emitter.d.cts","names":[],"sources":["../../src/helpers/create-emitter.ts"],"sourcesContent":[],"mappings":";KAoBK,QAAA,GAAW;UAEN,cAAA,CAFG;EAEH,KAAA,EACD,KADC;AACI;AAGO,UAAX,WAAA,CAIK;EAEL,MAAA,EAAA,MAAA;;KAFL,UAAA,GAAa,cAIV,GAJ2B,WAI3B;UAFE,YAAA,SAAqB,QAAA,CAAA;EAAQ,MAAA,EAC7B,UAD6B;EAKlC,IAAA,EAHG,WAGC;AAA0C;AAQnD,KARK,IAQW,CAAA,gBARU,QAQG,CAAA,GAAA,MARe,OAQf,GAAA,MAAA;KAPxB,QAOyC,CAAA,MAAA,CAAA,GAAA,CAAA,KAAA,EAPd,MAOc,EAAA,GAAA,IAAA;;;;;;AAKhC,iBALE,aAKF,CAAA,gBALgC,QAKhC,CAAA,CAAA,CAAA,EAAA;EAGkB,EAAA,EAAA;IAAL,CAAA,aALA,IAKA,CALK,OAKL,CAAA,CAAA,CAAA,GAAA,EAJlB,IAIkB,EAAA,QAAA,EAHb,QAGa,CAHJ,OAGI,CAHI,IAGJ,CAAA,CAAA,CAAA,EAAA,IAAA;IAClB,CAAA,aADkB,IAClB,CADuB,YACvB,CAAA,CAAA,CAAA,GAAA,EAAA,IAAA,EAAA,QAAA,EACK,QADL,CACc,YADd,CAC2B,IAD3B,CAAA,CAAA,CAAA,EAAA,IAAA;EACc,CAAA;EAAa,IAAA,EAAA,CAAA,aAOP,IAPO,CAOF,OAPE,CAAA,CAAA,CAAA,GAAA,EAOa,IAPb,EAAA,KAAA,EAO0B,OAP1B,CAOkC,IAPlC,CAAA,EAAA,GAAA,IAAA;CAAtB"}
@@ -1,2 +1,30 @@
1
- import { t as createEmitter } from "../create-emitter-Ccqc-tkP.mjs";
2
- export { createEmitter };
1
+ //#region src/helpers/create-emitter.d.ts
2
+ type EventMap = Record<string, object>;
3
+ interface EventWithError {
4
+ error: Error;
5
+ }
6
+ interface SystemEvent {
7
+ _event: string;
8
+ }
9
+ type ErrorEvent = EventWithError & SystemEvent;
10
+ interface SystemEvents extends EventMap {
11
+ _error: ErrorEvent;
12
+ _all: SystemEvent;
13
+ }
14
+ type Keys<TEvents extends EventMap> = keyof TEvents & string;
15
+ type Listener<TEvent> = (event: TEvent) => void;
16
+ /**
17
+ * Create an event emitter with typed events.
18
+ *
19
+ * @returns An event emitter instance with typed event handling.
20
+ */
21
+ declare function createEmitter<TEvents extends EventMap>(): {
22
+ on: {
23
+ <TKey extends Keys<TEvents>>(key: TKey, listener: Listener<TEvents[TKey]>): void;
24
+ <TKey extends Keys<SystemEvents>>(key: TKey, listener: Listener<SystemEvents[TKey]>): void;
25
+ };
26
+ emit: <TKey extends Keys<TEvents>>(key: TKey, event: TEvents[TKey]) => void;
27
+ };
28
+ //#endregion
29
+ export { createEmitter };
30
+ //# sourceMappingURL=create-emitter.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-emitter.d.mts","names":[],"sources":["../../src/helpers/create-emitter.ts"],"sourcesContent":[],"mappings":";KAoBK,QAAA,GAAW;UAEN,cAAA,CAFG;EAEH,KAAA,EACD,KADC;AACI;AAGO,UAAX,WAAA,CAIK;EAEL,MAAA,EAAA,MAAA;;KAFL,UAAA,GAAa,cAIV,GAJ2B,WAI3B;UAFE,YAAA,SAAqB,QAAA,CAAA;EAAQ,MAAA,EAC7B,UAD6B;EAKlC,IAAA,EAHG,WAGC;AAA0C;AAQnD,KARK,IAQW,CAAA,gBARU,QAQG,CAAA,GAAA,MARe,OAQf,GAAA,MAAA;KAPxB,QAOyC,CAAA,MAAA,CAAA,GAAA,CAAA,KAAA,EAPd,MAOc,EAAA,GAAA,IAAA;;;;;;AAKhC,iBALE,aAKF,CAAA,gBALgC,QAKhC,CAAA,CAAA,CAAA,EAAA;EAGkB,EAAA,EAAA;IAAL,CAAA,aALA,IAKA,CALK,OAKL,CAAA,CAAA,CAAA,GAAA,EAJlB,IAIkB,EAAA,QAAA,EAHb,QAGa,CAHJ,OAGI,CAHI,IAGJ,CAAA,CAAA,CAAA,EAAA,IAAA;IAClB,CAAA,aADkB,IAClB,CADuB,YACvB,CAAA,CAAA,CAAA,GAAA,EAAA,IAAA,EAAA,QAAA,EACK,QADL,CACc,YADd,CAC2B,IAD3B,CAAA,CAAA,CAAA,EAAA,IAAA;EACc,CAAA;EAAa,IAAA,EAAA,CAAA,aAOP,IAPO,CAOF,OAPE,CAAA,CAAA,CAAA,GAAA,EAOa,IAPb,EAAA,KAAA,EAO0B,OAP1B,CAOkC,IAPlC,CAAA,EAAA,GAAA,IAAA;CAAtB"}
@@ -1,3 +1,33 @@
1
- import { t as createEmitter } from "../create-emitter-CdX9SXDY.mjs";
1
+ import { EventEmitter } from "node:events";
2
2
 
3
- export { createEmitter };
3
+ //#region src/helpers/create-emitter.ts
4
+ /**
5
+ * Create an event emitter with typed events.
6
+ *
7
+ * @returns An event emitter instance with typed event handling.
8
+ */
9
+ function createEmitter() {
10
+ const emitter = new EventEmitter();
11
+ function on(key, listener) {
12
+ emitter.on(key, listener);
13
+ }
14
+ function emit(key, event) {
15
+ emitter.emit(key, event);
16
+ if (typeof event === "object" && event !== null && "error" in event) emitter.emit("_error", {
17
+ ...event,
18
+ _event: key
19
+ });
20
+ emitter.emit("_all", {
21
+ ...event,
22
+ _event: key
23
+ });
24
+ }
25
+ return {
26
+ on,
27
+ emit
28
+ };
29
+ }
30
+
31
+ //#endregion
32
+ export { createEmitter };
33
+ //# sourceMappingURL=create-emitter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-emitter.mjs","names":[],"sources":["../../src/helpers/create-emitter.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 { EventEmitter } from \"node:events\";\n\ntype EventMap = Record<string, object>;\n\ninterface EventWithError {\n error: Error;\n}\n\ninterface SystemEvent {\n _event: string;\n}\n\ntype ErrorEvent = EventWithError & SystemEvent;\n\ninterface SystemEvents extends EventMap {\n _error: ErrorEvent;\n _all: SystemEvent;\n}\n\ntype Keys<TEvents extends EventMap> = keyof TEvents & string;\ntype Listener<TEvent> = (event: TEvent) => void;\n\n/**\n * Create an event emitter with typed events.\n *\n * @returns An event emitter instance with typed event handling.\n */\nexport function createEmitter<TEvents extends EventMap>() {\n const emitter = new EventEmitter();\n\n function on<TKey extends Keys<TEvents>>(\n key: TKey,\n listener: Listener<TEvents[TKey]>\n ): void;\n\n function on<TKey extends Keys<SystemEvents>>(\n key: TKey,\n listener: Listener<SystemEvents[TKey]>\n ): void;\n\n function on(key: string, listener: Listener<any>) {\n emitter.on(key, listener);\n }\n\n function emit<TKey extends Keys<TEvents>>(key: TKey, event: TEvents[TKey]) {\n emitter.emit(key, event);\n\n if (typeof event === \"object\" && event !== null && \"error\" in event) {\n emitter.emit(\"_error\", {\n ...event,\n _event: key\n });\n }\n\n emitter.emit(\"_all\", {\n ...event,\n _event: key\n });\n }\n\n return {\n on,\n emit\n };\n}\n"],"mappings":";;;;;;;;AA6CA,SAAgB,gBAA0C;CACxD,MAAM,UAAU,IAAI,cAAc;CAYlC,SAAS,GAAG,KAAa,UAAyB;AAChD,UAAQ,GAAG,KAAK,SAAS;;CAG3B,SAAS,KAAiC,KAAW,OAAsB;AACzE,UAAQ,KAAK,KAAK,MAAM;AAExB,MAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,WAAW,MAC5D,SAAQ,KAAK,UAAU;GACrB,GAAG;GACH,QAAQ;GACT,CAAC;AAGJ,UAAQ,KAAK,QAAQ;GACnB,GAAG;GACH,QAAQ;GACT,CAAC;;AAGJ,QAAO;EACL;EACA;EACD"}
@@ -1,3 +1,41 @@
1
- const require_create_writer = require('../create-writer-B2z350kr.cjs');
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __content_collections_core = require("@content-collections/core");
3
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
4
+ let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
5
+ let pluralize = require("pluralize");
6
+ pluralize = require_rolldown_runtime.__toESM(pluralize);
7
+ let powerlines_lib_utilities_file_header = require("powerlines/lib/utilities/file-header");
2
8
 
3
- exports.createWriter = require_create_writer.createWriter;
9
+ //#region src/helpers/create-writer.ts
10
+ const createConstName = (name) => {
11
+ return (0, pluralize.default)(name.charAt(0).toUpperCase() + name.slice(1));
12
+ };
13
+ const createArrayConstName = (name) => {
14
+ return `all${createConstName(name)}`;
15
+ };
16
+ /**
17
+ *
18
+ * @param context - The Powerlines build plugin
19
+ * @returns
20
+ */
21
+ const createWriter = (context) => {
22
+ return {
23
+ createJavaScriptFile: async (configuration) => {
24
+ return context.emitBuiltin(`${(0, powerlines_lib_utilities_file_header.getBaseFileHeader)(context)}
25
+ ${configuration.collections.map(({ name }) => `import ${createArrayConstName(name)} from "./${(0, __stryke_string_format_kebab_case.kebabCase)(name)}";`).join("\n")}
26
+
27
+ export { ${configuration.collections.map(({ name }) => createArrayConstName(name)).join(", ")} };
28
+ `, "content");
29
+ },
30
+ createTypeDefinitionFile: async (_) => Promise.resolve(),
31
+ createDataFiles: async (collections) => {
32
+ await Promise.all(collections.map(async (collection) => {
33
+ if (context.config.contentCollections.outputPath) return context.fs.write((0, __stryke_path_join_paths.joinPaths)(context.config.contentCollections.outputPath, (0, __stryke_string_format_kebab_case.kebabCase)(collection.name)), (0, __content_collections_core.serialize)(collection.documents.map((doc) => doc.document)));
34
+ return context.emitBuiltin((0, __content_collections_core.serialize)(collection.documents.map((doc) => doc.document)), (0, __stryke_path_join_paths.joinPaths)("content", (0, __stryke_string_format_kebab_case.kebabCase)(collection.name)));
35
+ }));
36
+ }
37
+ };
38
+ };
39
+
40
+ //#endregion
41
+ exports.createWriter = createWriter;
@@ -1,3 +1,14 @@
1
- import "../plugin-sUSM5ZDl.cjs";
2
- import { t as createWriter } from "../create-writer-Bt5X22V1.cjs";
3
- export { createWriter };
1
+ import { ContentCollectionsPluginContext } from "../types/plugin.cjs";
2
+ import { Writer } from "@content-collections/core";
3
+
4
+ //#region src/helpers/create-writer.d.ts
5
+
6
+ /**
7
+ *
8
+ * @param context - The Powerlines build plugin
9
+ * @returns
10
+ */
11
+ declare const createWriter: (context: ContentCollectionsPluginContext) => Writer;
12
+ //#endregion
13
+ export { createWriter };
14
+ //# sourceMappingURL=create-writer.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-writer.d.cts","names":[],"sources":["../../src/helpers/create-writer.ts"],"sourcesContent":[],"mappings":";;;;;;;AA4CA;;;cAAa,wBACF,oCACR"}
@@ -1,3 +1,14 @@
1
- import "../plugin-B8NELjmq.mjs";
2
- import { t as createWriter } from "../create-writer-B1kiqShf.mjs";
3
- export { createWriter };
1
+ import { ContentCollectionsPluginContext } from "../types/plugin.mjs";
2
+ import { Writer } from "@content-collections/core";
3
+
4
+ //#region src/helpers/create-writer.d.ts
5
+
6
+ /**
7
+ *
8
+ * @param context - The Powerlines build plugin
9
+ * @returns
10
+ */
11
+ declare const createWriter: (context: ContentCollectionsPluginContext) => Writer;
12
+ //#endregion
13
+ export { createWriter };
14
+ //# sourceMappingURL=create-writer.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-writer.d.mts","names":[],"sources":["../../src/helpers/create-writer.ts"],"sourcesContent":[],"mappings":";;;;;;;AA4CA;;;cAAa,wBACF,oCACR"}
@@ -1,3 +1,40 @@
1
- import { t as createWriter } from "../create-writer-CCVVT4dm.mjs";
1
+ import { serialize } from "@content-collections/core";
2
+ import { joinPaths } from "@stryke/path/join-paths";
3
+ import { kebabCase } from "@stryke/string-format/kebab-case";
4
+ import pluralize from "pluralize";
5
+ import { getBaseFileHeader } from "powerlines/lib/utilities/file-header";
2
6
 
3
- export { createWriter };
7
+ //#region src/helpers/create-writer.ts
8
+ const createConstName = (name) => {
9
+ return pluralize(name.charAt(0).toUpperCase() + name.slice(1));
10
+ };
11
+ const createArrayConstName = (name) => {
12
+ return `all${createConstName(name)}`;
13
+ };
14
+ /**
15
+ *
16
+ * @param context - The Powerlines build plugin
17
+ * @returns
18
+ */
19
+ const createWriter = (context) => {
20
+ return {
21
+ createJavaScriptFile: async (configuration) => {
22
+ return context.emitBuiltin(`${getBaseFileHeader(context)}
23
+ ${configuration.collections.map(({ name }) => `import ${createArrayConstName(name)} from "./${kebabCase(name)}";`).join("\n")}
24
+
25
+ export { ${configuration.collections.map(({ name }) => createArrayConstName(name)).join(", ")} };
26
+ `, "content");
27
+ },
28
+ createTypeDefinitionFile: async (_) => Promise.resolve(),
29
+ createDataFiles: async (collections) => {
30
+ await Promise.all(collections.map(async (collection) => {
31
+ if (context.config.contentCollections.outputPath) return context.fs.write(joinPaths(context.config.contentCollections.outputPath, kebabCase(collection.name)), serialize(collection.documents.map((doc) => doc.document)));
32
+ return context.emitBuiltin(serialize(collection.documents.map((doc) => doc.document)), joinPaths("content", kebabCase(collection.name)));
33
+ }));
34
+ }
35
+ };
36
+ };
37
+
38
+ //#endregion
39
+ export { createWriter };
40
+ //# sourceMappingURL=create-writer.mjs.map
@@ -0,0 +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,6 +1,5 @@
1
- const require_create_writer = require('../create-writer-B2z350kr.cjs');
2
- const require_create_emitter = require('../create-emitter-9FUdmUDk.cjs');
3
- require('../helpers-yB1XkvQI.cjs');
1
+ const require_helpers_create_emitter = require('./create-emitter.cjs');
2
+ const require_helpers_create_writer = require('./create-writer.cjs');
4
3
 
5
- exports.createEmitter = require_create_emitter.createEmitter;
6
- exports.createWriter = require_create_writer.createWriter;
4
+ exports.createEmitter = require_helpers_create_emitter.createEmitter;
5
+ exports.createWriter = require_helpers_create_writer.createWriter;
@@ -1,5 +1,3 @@
1
- import { t as createEmitter } from "../create-emitter-Bk1iruR0.cjs";
2
- import "../plugin-sUSM5ZDl.cjs";
3
- import { t as createWriter } from "../create-writer-Bt5X22V1.cjs";
4
- import "../index-BR1oNnaF.cjs";
1
+ import { createEmitter } from "./create-emitter.cjs";
2
+ import { createWriter } from "./create-writer.cjs";
5
3
  export { createEmitter, createWriter };
@@ -1,5 +1,3 @@
1
- import { t as createEmitter } from "../create-emitter-Ccqc-tkP.mjs";
2
- import "../plugin-B8NELjmq.mjs";
3
- import { t as createWriter } from "../create-writer-B1kiqShf.mjs";
4
- import "../index-DNLi60D-.mjs";
1
+ import { createEmitter } from "./create-emitter.mjs";
2
+ import { createWriter } from "./create-writer.mjs";
5
3
  export { createEmitter, createWriter };
@@ -1,5 +1,4 @@
1
- import { t as createEmitter } from "../create-emitter-CdX9SXDY.mjs";
2
- import { t as createWriter } from "../create-writer-CCVVT4dm.mjs";
3
- import "../helpers-y2jvHwgF.mjs";
1
+ import { createEmitter } from "./create-emitter.mjs";
2
+ import { createWriter } from "./create-writer.mjs";
4
3
 
5
4
  export { createEmitter, createWriter };
package/dist/index.cjs CHANGED
@@ -1,14 +1,13 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- const require_create_writer = require('./create-writer-B2z350kr.cjs');
3
- const require_create_emitter = require('./create-emitter-9FUdmUDk.cjs');
4
- require('./helpers-yB1XkvQI.cjs');
5
- require('./plugin-Ckx8qAq8.cjs');
6
- require('./types-a8gm_IaQ.cjs');
2
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
+ const require_helpers_create_emitter = require('./helpers/create-emitter.cjs');
4
+ const require_helpers_create_writer = require('./helpers/create-writer.cjs');
5
+ require('./helpers/index.cjs');
7
6
  let __content_collections_core = require("@content-collections/core");
8
7
  let __stryke_fs_exists = require("@stryke/fs/exists");
9
8
  let __stryke_path_join = require("@stryke/path/join");
10
9
  let defu = require("defu");
11
- defu = require_create_writer.__toESM(defu);
10
+ defu = require_rolldown_runtime.__toESM(defu);
12
11
  let node_crypto = require("node:crypto");
13
12
  let powerlines_plugin_utils_paths = require("powerlines/plugin-utils/paths");
14
13
 
@@ -31,7 +30,7 @@ const plugin = (options) => {
31
30
  async configResolved() {
32
31
  this.config.contentCollections.configFile ||= (0, powerlines_plugin_utils_paths.replacePathTokens)(this, this.config.contentCollections.configFile);
33
32
  this.config.contentCollections.outputPath ||= (0, powerlines_plugin_utils_paths.replacePathTokens)(this, this.config.contentCollections.outputPath);
34
- const emitter = require_create_emitter.createEmitter();
33
+ const emitter = require_helpers_create_emitter.createEmitter();
35
34
  const readConfiguration = (0, __content_collections_core.createConfigurationReader)();
36
35
  let configuration = {};
37
36
  try {
@@ -48,7 +47,7 @@ const plugin = (options) => {
48
47
  outputDirectory: this.config.contentCollections.outputPath || (0, __stryke_path_join.joinPaths)(this.builtinsPath, "content"),
49
48
  configuration
50
49
  });
51
- context.writer = require_create_writer.createWriter(this);
50
+ context.writer = require_helpers_create_writer.createWriter(this);
52
51
  this.contentCollections = {
53
52
  context,
54
53
  build: async () => (0, __content_collections_core.build)(context),
@@ -63,7 +62,7 @@ const plugin = (options) => {
63
62
  var src_default = plugin;
64
63
 
65
64
  //#endregion
66
- exports.createEmitter = require_create_emitter.createEmitter;
67
- exports.createWriter = require_create_writer.createWriter;
65
+ exports.createEmitter = require_helpers_create_emitter.createEmitter;
66
+ exports.createWriter = require_helpers_create_writer.createWriter;
68
67
  exports.default = src_default;
69
68
  exports.plugin = plugin;
package/dist/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- import { t as createEmitter } from "./create-emitter-Bk1iruR0.cjs";
2
- import { a as ContentCollectionsPluginUserConfig, c as __ΩContentCollectionsPluginOptions, i as ContentCollectionsPluginResolvedConfig, l as __ΩContentCollectionsPluginResolvedConfig, n as ContentCollectionsPluginContext, o as __ΩContentCollectionsContext, r as ContentCollectionsPluginOptions, s as __ΩContentCollectionsPluginContext, t as ContentCollectionsContext, u as __ΩContentCollectionsPluginUserConfig } from "./plugin-sUSM5ZDl.cjs";
3
- import { t as createWriter } from "./create-writer-Bt5X22V1.cjs";
4
- import "./index-BR1oNnaF.cjs";
5
- import "./index-BL32-cvv.cjs";
1
+ import { createEmitter } from "./helpers/create-emitter.cjs";
2
+ import { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig } from "./types/plugin.cjs";
3
+ import { createWriter } from "./helpers/create-writer.cjs";
4
+ import "./helpers/index.cjs";
5
+ import "./types/index.cjs";
6
6
  import { Plugin } from "powerlines/types/plugin";
7
7
 
8
8
  //#region src/index.d.ts
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { t as createEmitter } from "./create-emitter-Ccqc-tkP.mjs";
2
- import { a as ContentCollectionsPluginUserConfig, c as __ΩContentCollectionsPluginOptions, i as ContentCollectionsPluginResolvedConfig, l as __ΩContentCollectionsPluginResolvedConfig, n as ContentCollectionsPluginContext, o as __ΩContentCollectionsContext, r as ContentCollectionsPluginOptions, s as __ΩContentCollectionsPluginContext, t as ContentCollectionsContext, u as __ΩContentCollectionsPluginUserConfig } from "./plugin-B8NELjmq.mjs";
3
- import { t as createWriter } from "./create-writer-B1kiqShf.mjs";
4
- import "./index-DNLi60D-.mjs";
5
- import "./index-Bk0eNZmQ.mjs";
1
+ import { createEmitter } from "./helpers/create-emitter.mjs";
2
+ import { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig } from "./types/plugin.mjs";
3
+ import { createWriter } from "./helpers/create-writer.mjs";
4
+ import "./helpers/index.mjs";
5
+ import "./types/index.mjs";
6
6
  import { Plugin } from "powerlines/types/plugin";
7
7
 
8
8
  //#region src/index.d.ts
package/dist/index.mjs CHANGED
@@ -1,8 +1,6 @@
1
- import { t as createEmitter } from "./create-emitter-CdX9SXDY.mjs";
2
- import { t as createWriter } from "./create-writer-CCVVT4dm.mjs";
3
- import "./helpers-y2jvHwgF.mjs";
4
- import "./plugin-B0q2kj8i.mjs";
5
- import "./types--fVOUYBq.mjs";
1
+ import { createEmitter } from "./helpers/create-emitter.mjs";
2
+ import { createWriter } from "./helpers/create-writer.mjs";
3
+ import "./helpers/index.mjs";
6
4
  import { build, createBuildContext, createConfigurationReader } from "@content-collections/core";
7
5
  import { existsSync } from "@stryke/fs/exists";
8
6
  import { joinPaths } from "@stryke/path/join";
@@ -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 {\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,YAAY,MAAM,QAAQ;IACjC,IAAI,QAAQ;IACb;;EAEH,MAAM,UAAU;AACd,UAAO,KAAK,mBAAmB,OAAO;;EAEzC;;AAGH,kBAAe"}
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 {\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,YAAY,MAAM,QAAQ;IACjC,IAAI,QAAQ;IACb;;EAEH,MAAM,UAAU;AACd,UAAO,KAAK,mBAAmB,OAAO;;EAEzC;;AAGH,kBAAe"}
@@ -1,2 +0,0 @@
1
- require('../plugin-Ckx8qAq8.cjs');
2
- require('../types-a8gm_IaQ.cjs');
@@ -1,3 +1,2 @@
1
- import { a as ContentCollectionsPluginUserConfig, c as __ΩContentCollectionsPluginOptions, i as ContentCollectionsPluginResolvedConfig, l as __ΩContentCollectionsPluginResolvedConfig, n as ContentCollectionsPluginContext, o as __ΩContentCollectionsContext, r as ContentCollectionsPluginOptions, s as __ΩContentCollectionsPluginContext, t as ContentCollectionsContext, u as __ΩContentCollectionsPluginUserConfig } from "../plugin-sUSM5ZDl.cjs";
2
- import "../index-BL32-cvv.cjs";
1
+ import { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig } from "./plugin.cjs";
3
2
  export { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig };
@@ -1,3 +1,2 @@
1
- import { a as ContentCollectionsPluginUserConfig, c as __ΩContentCollectionsPluginOptions, i as ContentCollectionsPluginResolvedConfig, l as __ΩContentCollectionsPluginResolvedConfig, n as ContentCollectionsPluginContext, o as __ΩContentCollectionsContext, r as ContentCollectionsPluginOptions, s as __ΩContentCollectionsPluginContext, t as ContentCollectionsContext, u as __ΩContentCollectionsPluginUserConfig } from "../plugin-B8NELjmq.mjs";
2
- import "../index-Bk0eNZmQ.mjs";
1
+ import { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig } from "./plugin.mjs";
3
2
  export { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig };
@@ -1,4 +1 @@
1
- import "../plugin-B0q2kj8i.mjs";
2
- import "../types--fVOUYBq.mjs";
3
-
4
1
  export { };
@@ -1 +0,0 @@
1
- require('../plugin-Ckx8qAq8.cjs');
@@ -1,2 +1,50 @@
1
- import { a as ContentCollectionsPluginUserConfig, c as __ΩContentCollectionsPluginOptions, i as ContentCollectionsPluginResolvedConfig, l as __ΩContentCollectionsPluginResolvedConfig, n as ContentCollectionsPluginContext, o as __ΩContentCollectionsContext, r as ContentCollectionsPluginOptions, s as __ΩContentCollectionsPluginContext, t as ContentCollectionsContext, u as __ΩContentCollectionsPluginUserConfig } from "../plugin-sUSM5ZDl.cjs";
2
- export { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig };
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";
5
+
6
+ //#region src/types/plugin.d.ts
7
+ type ContentCollectionsContext = Pick<Awaited<ReturnType<typeof createInternalBuilder>>, "build" | "on"> & {
8
+ context: BuildContext;
9
+ };
10
+ interface ContentCollectionsPluginOptions {
11
+ /**
12
+ * The path to a custom Prisma configuration file.
13
+ *
14
+ * @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.
16
+ *
17
+ * @defaultValue "\{projectRoot\}/content-collections.ts"
18
+ */
19
+ configFile?: string;
20
+ /**
21
+ * The list of content collections to include.
22
+ */
23
+ collections?: AnyCollection[];
24
+ /**
25
+ * The path to the content collection output files generated by the plugin.
26
+ *
27
+ * @remarks
28
+ * If using the default value, the file can be imported from "powerlines:content/collection-name". This field allows the use of the "\{builtinPath\}" token to refer to the built-in Powerlines plugins directory - the value will be replaced with the correct file path by the plugin.
29
+ *
30
+ * @defaultValue "\{builtinPath\}/content"
31
+ */
32
+ outputPath?: string;
33
+ }
34
+ type ContentCollectionsPluginUserConfig = UserConfig & {
35
+ contentCollections?: ContentCollectionsPluginOptions;
36
+ };
37
+ type ContentCollectionsPluginResolvedConfig = ResolvedConfig & {
38
+ contentCollections: Required<Omit<ContentCollectionsPluginOptions, "outputPath">> & Pick<ContentCollectionsPluginOptions, "outputPath">;
39
+ };
40
+ type ContentCollectionsPluginContext<TResolvedConfig extends ContentCollectionsPluginResolvedConfig = ContentCollectionsPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
41
+ contentCollections: ContentCollectionsContext;
42
+ };
43
+ declare type __ΩContentCollectionsContext = any[];
44
+ declare type __ΩContentCollectionsPluginOptions = any[];
45
+ declare type __ΩContentCollectionsPluginUserConfig = any[];
46
+ declare type __ΩContentCollectionsPluginResolvedConfig = any[];
47
+ declare type __ΩContentCollectionsPluginContext = any[];
48
+ //#endregion
49
+ export { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig };
50
+ //# sourceMappingURL=plugin.d.cts.map
@@ -0,0 +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,2 +1,50 @@
1
- import { a as ContentCollectionsPluginUserConfig, c as __ΩContentCollectionsPluginOptions, i as ContentCollectionsPluginResolvedConfig, l as __ΩContentCollectionsPluginResolvedConfig, n as ContentCollectionsPluginContext, o as __ΩContentCollectionsContext, r as ContentCollectionsPluginOptions, s as __ΩContentCollectionsPluginContext, t as ContentCollectionsContext, u as __ΩContentCollectionsPluginUserConfig } from "../plugin-B8NELjmq.mjs";
2
- export { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig };
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";
5
+
6
+ //#region src/types/plugin.d.ts
7
+ type ContentCollectionsContext = Pick<Awaited<ReturnType<typeof createInternalBuilder>>, "build" | "on"> & {
8
+ context: BuildContext;
9
+ };
10
+ interface ContentCollectionsPluginOptions {
11
+ /**
12
+ * The path to a custom Prisma configuration file.
13
+ *
14
+ * @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.
16
+ *
17
+ * @defaultValue "\{projectRoot\}/content-collections.ts"
18
+ */
19
+ configFile?: string;
20
+ /**
21
+ * The list of content collections to include.
22
+ */
23
+ collections?: AnyCollection[];
24
+ /**
25
+ * The path to the content collection output files generated by the plugin.
26
+ *
27
+ * @remarks
28
+ * If using the default value, the file can be imported from "powerlines:content/collection-name". This field allows the use of the "\{builtinPath\}" token to refer to the built-in Powerlines plugins directory - the value will be replaced with the correct file path by the plugin.
29
+ *
30
+ * @defaultValue "\{builtinPath\}/content"
31
+ */
32
+ outputPath?: string;
33
+ }
34
+ type ContentCollectionsPluginUserConfig = UserConfig & {
35
+ contentCollections?: ContentCollectionsPluginOptions;
36
+ };
37
+ type ContentCollectionsPluginResolvedConfig = ResolvedConfig & {
38
+ contentCollections: Required<Omit<ContentCollectionsPluginOptions, "outputPath">> & Pick<ContentCollectionsPluginOptions, "outputPath">;
39
+ };
40
+ type ContentCollectionsPluginContext<TResolvedConfig extends ContentCollectionsPluginResolvedConfig = ContentCollectionsPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
41
+ contentCollections: ContentCollectionsContext;
42
+ };
43
+ declare type __ΩContentCollectionsContext = any[];
44
+ declare type __ΩContentCollectionsPluginOptions = any[];
45
+ declare type __ΩContentCollectionsPluginUserConfig = any[];
46
+ declare type __ΩContentCollectionsPluginResolvedConfig = any[];
47
+ declare type __ΩContentCollectionsPluginContext = any[];
48
+ //#endregion
49
+ export { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig };
50
+ //# sourceMappingURL=plugin.d.mts.map
@@ -0,0 +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,3 +1 @@
1
- import "../plugin-B0q2kj8i.mjs";
2
-
3
1
  export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-content-collections",
3
- "version": "0.1.253",
3
+ "version": "0.1.254",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin to generate project code using Content Collections.",
6
6
  "repository": {
@@ -145,14 +145,14 @@
145
145
  "@stryke/types": "^0.10.37",
146
146
  "defu": "^6.1.4",
147
147
  "pluralize": "^8.0.0",
148
- "powerlines": "^0.38.20"
148
+ "powerlines": "^0.38.21"
149
149
  },
150
150
  "devDependencies": {
151
- "@powerlines/plugin-plugin": "^0.12.204",
151
+ "@powerlines/plugin-plugin": "^0.12.205",
152
152
  "@types/node": "^24.10.9",
153
153
  "@types/pluralize": "^0.0.33"
154
154
  },
155
155
  "publishConfig": { "access": "public" },
156
156
  "types": "./dist/index.d.cts",
157
- "gitHead": "54a89805dd69f77013ebbd3282232563d7af4e7b"
157
+ "gitHead": "6000a15bf3fbc1b7eaaf967088c68eef9949786a"
158
158
  }
@@ -1,38 +0,0 @@
1
- const require_create_writer = require('./create-writer-B2z350kr.cjs');
2
- let node_events = require("node:events");
3
-
4
- //#region src/helpers/create-emitter.ts
5
- /**
6
- * Create an event emitter with typed events.
7
- *
8
- * @returns An event emitter instance with typed event handling.
9
- */
10
- function createEmitter() {
11
- const emitter = new node_events.EventEmitter();
12
- function on(key, listener) {
13
- emitter.on(key, listener);
14
- }
15
- function emit(key, event) {
16
- emitter.emit(key, event);
17
- if (typeof event === "object" && event !== null && "error" in event) emitter.emit("_error", {
18
- ...event,
19
- _event: key
20
- });
21
- emitter.emit("_all", {
22
- ...event,
23
- _event: key
24
- });
25
- }
26
- return {
27
- on,
28
- emit
29
- };
30
- }
31
-
32
- //#endregion
33
- Object.defineProperty(exports, 'createEmitter', {
34
- enumerable: true,
35
- get: function () {
36
- return createEmitter;
37
- }
38
- });
@@ -1,30 +0,0 @@
1
- //#region src/helpers/create-emitter.d.ts
2
- type EventMap = Record<string, object>;
3
- interface EventWithError {
4
- error: Error;
5
- }
6
- interface SystemEvent {
7
- _event: string;
8
- }
9
- type ErrorEvent = EventWithError & SystemEvent;
10
- interface SystemEvents extends EventMap {
11
- _error: ErrorEvent;
12
- _all: SystemEvent;
13
- }
14
- type Keys<TEvents extends EventMap> = keyof TEvents & string;
15
- type Listener<TEvent> = (event: TEvent) => void;
16
- /**
17
- * Create an event emitter with typed events.
18
- *
19
- * @returns An event emitter instance with typed event handling.
20
- */
21
- declare function createEmitter<TEvents extends EventMap>(): {
22
- on: {
23
- <TKey extends Keys<TEvents>>(key: TKey, listener: Listener<TEvents[TKey]>): void;
24
- <TKey extends Keys<SystemEvents>>(key: TKey, listener: Listener<SystemEvents[TKey]>): void;
25
- };
26
- emit: <TKey extends Keys<TEvents>>(key: TKey, event: TEvents[TKey]) => void;
27
- };
28
- //#endregion
29
- export { createEmitter as t };
30
- //# sourceMappingURL=create-emitter-Bk1iruR0.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-emitter-Bk1iruR0.d.cts","names":[],"sources":["../src/helpers/create-emitter.ts"],"sourcesContent":[],"mappings":";KAoBK,QAAA,GAAW;UAEN,cAAA,CAFG;EAEH,KAAA,EACD,KADC;AACI;AAGO,UAAX,WAAA,CAIK;EAEL,MAAA,EAAA,MAAA;;KAFL,UAAA,GAAa,cAIV,GAJ2B,WAI3B;UAFE,YAAA,SAAqB,QAAA,CAAA;EAAQ,MAAA,EAC7B,UAD6B;EAKlC,IAAA,EAHG,WAGC;AAA0C;AAQnD,KARK,IAQW,CAAA,gBARU,QAQG,CAAA,GAAA,MARe,OAQf,GAAA,MAAA;KAPxB,QAOyC,CAAA,MAAA,CAAA,GAAA,CAAA,KAAA,EAPd,MAOc,EAAA,GAAA,IAAA;;;;;;AAKhC,iBALE,aAKF,CAAA,gBALgC,QAKhC,CAAA,CAAA,CAAA,EAAA;EAGkB,EAAA,EAAA;IAAL,CAAA,aALA,IAKA,CALK,OAKL,CAAA,CAAA,CAAA,GAAA,EAJlB,IAIkB,EAAA,QAAA,EAHb,QAGa,CAHJ,OAGI,CAHI,IAGJ,CAAA,CAAA,CAAA,EAAA,IAAA;IAClB,CAAA,aADkB,IAClB,CADuB,YACvB,CAAA,CAAA,CAAA,GAAA,EAAA,IAAA,EAAA,QAAA,EACK,QADL,CACc,YADd,CAC2B,IAD3B,CAAA,CAAA,CAAA,EAAA,IAAA;EACc,CAAA;EAAa,IAAA,EAAA,CAAA,aAOP,IAPO,CAOF,OAPE,CAAA,CAAA,CAAA,GAAA,EAOa,IAPb,EAAA,KAAA,EAO0B,OAP1B,CAOkC,IAPlC,CAAA,EAAA,GAAA,IAAA;CAAtB"}
@@ -1,30 +0,0 @@
1
- //#region src/helpers/create-emitter.d.ts
2
- type EventMap = Record<string, object>;
3
- interface EventWithError {
4
- error: Error;
5
- }
6
- interface SystemEvent {
7
- _event: string;
8
- }
9
- type ErrorEvent = EventWithError & SystemEvent;
10
- interface SystemEvents extends EventMap {
11
- _error: ErrorEvent;
12
- _all: SystemEvent;
13
- }
14
- type Keys<TEvents extends EventMap> = keyof TEvents & string;
15
- type Listener<TEvent> = (event: TEvent) => void;
16
- /**
17
- * Create an event emitter with typed events.
18
- *
19
- * @returns An event emitter instance with typed event handling.
20
- */
21
- declare function createEmitter<TEvents extends EventMap>(): {
22
- on: {
23
- <TKey extends Keys<TEvents>>(key: TKey, listener: Listener<TEvents[TKey]>): void;
24
- <TKey extends Keys<SystemEvents>>(key: TKey, listener: Listener<SystemEvents[TKey]>): void;
25
- };
26
- emit: <TKey extends Keys<TEvents>>(key: TKey, event: TEvents[TKey]) => void;
27
- };
28
- //#endregion
29
- export { createEmitter as t };
30
- //# sourceMappingURL=create-emitter-Ccqc-tkP.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-emitter-Ccqc-tkP.d.mts","names":[],"sources":["../src/helpers/create-emitter.ts"],"sourcesContent":[],"mappings":";KAoBK,QAAA,GAAW;UAEN,cAAA,CAFG;EAEH,KAAA,EACD,KADC;AACI;AAGO,UAAX,WAAA,CAIK;EAEL,MAAA,EAAA,MAAA;;KAFL,UAAA,GAAa,cAIV,GAJ2B,WAI3B;UAFE,YAAA,SAAqB,QAAA,CAAA;EAAQ,MAAA,EAC7B,UAD6B;EAKlC,IAAA,EAHG,WAGC;AAA0C;AAQnD,KARK,IAQW,CAAA,gBARU,QAQG,CAAA,GAAA,MARe,OAQf,GAAA,MAAA;KAPxB,QAOyC,CAAA,MAAA,CAAA,GAAA,CAAA,KAAA,EAPd,MAOc,EAAA,GAAA,IAAA;;;;;;AAKhC,iBALE,aAKF,CAAA,gBALgC,QAKhC,CAAA,CAAA,CAAA,EAAA;EAGkB,EAAA,EAAA;IAAL,CAAA,aALA,IAKA,CALK,OAKL,CAAA,CAAA,CAAA,GAAA,EAJlB,IAIkB,EAAA,QAAA,EAHb,QAGa,CAHJ,OAGI,CAHI,IAGJ,CAAA,CAAA,CAAA,EAAA,IAAA;IAClB,CAAA,aADkB,IAClB,CADuB,YACvB,CAAA,CAAA,CAAA,GAAA,EAAA,IAAA,EAAA,QAAA,EACK,QADL,CACc,YADd,CAC2B,IAD3B,CAAA,CAAA,CAAA,EAAA,IAAA;EACc,CAAA;EAAa,IAAA,EAAA,CAAA,aAOP,IAPO,CAOF,OAPE,CAAA,CAAA,CAAA,GAAA,EAOa,IAPb,EAAA,KAAA,EAO0B,OAP1B,CAOkC,IAPlC,CAAA,EAAA,GAAA,IAAA;CAAtB"}
@@ -1,33 +0,0 @@
1
- import { EventEmitter } from "node:events";
2
-
3
- //#region src/helpers/create-emitter.ts
4
- /**
5
- * Create an event emitter with typed events.
6
- *
7
- * @returns An event emitter instance with typed event handling.
8
- */
9
- function createEmitter() {
10
- const emitter = new EventEmitter();
11
- function on(key, listener) {
12
- emitter.on(key, listener);
13
- }
14
- function emit(key, event) {
15
- emitter.emit(key, event);
16
- if (typeof event === "object" && event !== null && "error" in event) emitter.emit("_error", {
17
- ...event,
18
- _event: key
19
- });
20
- emitter.emit("_all", {
21
- ...event,
22
- _event: key
23
- });
24
- }
25
- return {
26
- on,
27
- emit
28
- };
29
- }
30
-
31
- //#endregion
32
- export { createEmitter as t };
33
- //# sourceMappingURL=create-emitter-CdX9SXDY.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-emitter-CdX9SXDY.mjs","names":[],"sources":["../src/helpers/create-emitter.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 { EventEmitter } from \"node:events\";\n\ntype EventMap = Record<string, object>;\n\ninterface EventWithError {\n error: Error;\n}\n\ninterface SystemEvent {\n _event: string;\n}\n\ntype ErrorEvent = EventWithError & SystemEvent;\n\ninterface SystemEvents extends EventMap {\n _error: ErrorEvent;\n _all: SystemEvent;\n}\n\ntype Keys<TEvents extends EventMap> = keyof TEvents & string;\ntype Listener<TEvent> = (event: TEvent) => void;\n\n/**\n * Create an event emitter with typed events.\n *\n * @returns An event emitter instance with typed event handling.\n */\nexport function createEmitter<TEvents extends EventMap>() {\n const emitter = new EventEmitter();\n\n function on<TKey extends Keys<TEvents>>(\n key: TKey,\n listener: Listener<TEvents[TKey]>\n ): void;\n\n function on<TKey extends Keys<SystemEvents>>(\n key: TKey,\n listener: Listener<SystemEvents[TKey]>\n ): void;\n\n function on(key: string, listener: Listener<any>) {\n emitter.on(key, listener);\n }\n\n function emit<TKey extends Keys<TEvents>>(key: TKey, event: TEvents[TKey]) {\n emitter.emit(key, event);\n\n if (typeof event === \"object\" && event !== null && \"error\" in event) {\n emitter.emit(\"_error\", {\n ...event,\n _event: key\n });\n }\n\n emitter.emit(\"_all\", {\n ...event,\n _event: key\n });\n }\n\n return {\n on,\n emit\n };\n}\n"],"mappings":";;;;;;;;AA6CA,SAAgB,gBAA0C;CACxD,MAAM,UAAU,IAAI,cAAc;CAYlC,SAAS,GAAG,KAAa,UAAyB;AAChD,UAAQ,GAAG,KAAK,SAAS;;CAG3B,SAAS,KAAiC,KAAW,OAAsB;AACzE,UAAQ,KAAK,KAAK,MAAM;AAExB,MAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,WAAW,MAC5D,SAAQ,KAAK,UAAU;GACrB,GAAG;GACH,QAAQ;GACT,CAAC;AAGJ,UAAQ,KAAK,QAAQ;GACnB,GAAG;GACH,QAAQ;GACT,CAAC;;AAGJ,QAAO;EACL;EACA;EACD"}
@@ -1,14 +0,0 @@
1
- import { n as ContentCollectionsPluginContext } from "./plugin-B8NELjmq.mjs";
2
- import { Writer } from "@content-collections/core";
3
-
4
- //#region src/helpers/create-writer.d.ts
5
-
6
- /**
7
- *
8
- * @param context - The Powerlines build plugin
9
- * @returns
10
- */
11
- declare const createWriter: (context: ContentCollectionsPluginContext) => Writer;
12
- //#endregion
13
- export { createWriter as t };
14
- //# sourceMappingURL=create-writer-B1kiqShf.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-writer-B1kiqShf.d.mts","names":[],"sources":["../src/helpers/create-writer.ts"],"sourcesContent":[],"mappings":";;;;;;;AA4CA;;;cAAa,wBACF,oCACR"}
@@ -1,78 +0,0 @@
1
- //#region rolldown:runtime
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
- let __content_collections_core = require("@content-collections/core");
29
- let __stryke_path_join_paths = require("@stryke/path/join-paths");
30
- let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
31
- let pluralize = require("pluralize");
32
- pluralize = __toESM(pluralize);
33
- let powerlines_lib_utilities_file_header = require("powerlines/lib/utilities/file-header");
34
-
35
- //#region src/helpers/create-writer.ts
36
- const createConstName = (name) => {
37
- return (0, pluralize.default)(name.charAt(0).toUpperCase() + name.slice(1));
38
- };
39
- const createArrayConstName = (name) => {
40
- return `all${createConstName(name)}`;
41
- };
42
- /**
43
- *
44
- * @param context - The Powerlines build plugin
45
- * @returns
46
- */
47
- const createWriter = (context) => {
48
- return {
49
- createJavaScriptFile: async (configuration) => {
50
- return context.emitBuiltin(`${(0, powerlines_lib_utilities_file_header.getBaseFileHeader)(context)}
51
- ${configuration.collections.map(({ name }) => `import ${createArrayConstName(name)} from "./${(0, __stryke_string_format_kebab_case.kebabCase)(name)}";`).join("\n")}
52
-
53
- export { ${configuration.collections.map(({ name }) => createArrayConstName(name)).join(", ")} };
54
- `, "content");
55
- },
56
- createTypeDefinitionFile: async (_) => Promise.resolve(),
57
- createDataFiles: async (collections) => {
58
- await Promise.all(collections.map(async (collection) => {
59
- if (context.config.contentCollections.outputPath) return context.fs.write((0, __stryke_path_join_paths.joinPaths)(context.config.contentCollections.outputPath, (0, __stryke_string_format_kebab_case.kebabCase)(collection.name)), (0, __content_collections_core.serialize)(collection.documents.map((doc) => doc.document)));
60
- return context.emitBuiltin((0, __content_collections_core.serialize)(collection.documents.map((doc) => doc.document)), (0, __stryke_path_join_paths.joinPaths)("content", (0, __stryke_string_format_kebab_case.kebabCase)(collection.name)));
61
- }));
62
- }
63
- };
64
- };
65
-
66
- //#endregion
67
- Object.defineProperty(exports, '__toESM', {
68
- enumerable: true,
69
- get: function () {
70
- return __toESM;
71
- }
72
- });
73
- Object.defineProperty(exports, 'createWriter', {
74
- enumerable: true,
75
- get: function () {
76
- return createWriter;
77
- }
78
- });
@@ -1,14 +0,0 @@
1
- import { n as ContentCollectionsPluginContext } from "./plugin-sUSM5ZDl.cjs";
2
- import { Writer } from "@content-collections/core";
3
-
4
- //#region src/helpers/create-writer.d.ts
5
-
6
- /**
7
- *
8
- * @param context - The Powerlines build plugin
9
- * @returns
10
- */
11
- declare const createWriter: (context: ContentCollectionsPluginContext) => Writer;
12
- //#endregion
13
- export { createWriter as t };
14
- //# sourceMappingURL=create-writer-Bt5X22V1.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-writer-Bt5X22V1.d.cts","names":[],"sources":["../src/helpers/create-writer.ts"],"sourcesContent":[],"mappings":";;;;;;;AA4CA;;;cAAa,wBACF,oCACR"}
@@ -1,40 +0,0 @@
1
- import { serialize } from "@content-collections/core";
2
- import { joinPaths } from "@stryke/path/join-paths";
3
- import { kebabCase } from "@stryke/string-format/kebab-case";
4
- import pluralize from "pluralize";
5
- import { getBaseFileHeader } from "powerlines/lib/utilities/file-header";
6
-
7
- //#region src/helpers/create-writer.ts
8
- const createConstName = (name) => {
9
- return pluralize(name.charAt(0).toUpperCase() + name.slice(1));
10
- };
11
- const createArrayConstName = (name) => {
12
- return `all${createConstName(name)}`;
13
- };
14
- /**
15
- *
16
- * @param context - The Powerlines build plugin
17
- * @returns
18
- */
19
- const createWriter = (context) => {
20
- return {
21
- createJavaScriptFile: async (configuration) => {
22
- return context.emitBuiltin(`${getBaseFileHeader(context)}
23
- ${configuration.collections.map(({ name }) => `import ${createArrayConstName(name)} from "./${kebabCase(name)}";`).join("\n")}
24
-
25
- export { ${configuration.collections.map(({ name }) => createArrayConstName(name)).join(", ")} };
26
- `, "content");
27
- },
28
- createTypeDefinitionFile: async (_) => Promise.resolve(),
29
- createDataFiles: async (collections) => {
30
- await Promise.all(collections.map(async (collection) => {
31
- if (context.config.contentCollections.outputPath) return context.fs.write(joinPaths(context.config.contentCollections.outputPath, kebabCase(collection.name)), serialize(collection.documents.map((doc) => doc.document)));
32
- return context.emitBuiltin(serialize(collection.documents.map((doc) => doc.document)), joinPaths("content", kebabCase(collection.name)));
33
- }));
34
- }
35
- };
36
- };
37
-
38
- //#endregion
39
- export { createWriter as t };
40
- //# sourceMappingURL=create-writer-CCVVT4dm.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-writer-CCVVT4dm.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 +0,0 @@
1
- export { };
File without changes
@@ -1 +0,0 @@
1
- export { };
@@ -1 +0,0 @@
1
- export { };
@@ -1 +0,0 @@
1
- export { };
@@ -1 +0,0 @@
1
- export { };
@@ -1 +0,0 @@
1
- export { };
@@ -1,50 +0,0 @@
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";
5
-
6
- //#region src/types/plugin.d.ts
7
- type ContentCollectionsContext = Pick<Awaited<ReturnType<typeof createInternalBuilder>>, "build" | "on"> & {
8
- context: BuildContext;
9
- };
10
- interface ContentCollectionsPluginOptions {
11
- /**
12
- * The path to a custom Prisma configuration file.
13
- *
14
- * @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.
16
- *
17
- * @defaultValue "\{projectRoot\}/content-collections.ts"
18
- */
19
- configFile?: string;
20
- /**
21
- * The list of content collections to include.
22
- */
23
- collections?: AnyCollection[];
24
- /**
25
- * The path to the content collection output files generated by the plugin.
26
- *
27
- * @remarks
28
- * If using the default value, the file can be imported from "powerlines:content/collection-name". This field allows the use of the "\{builtinPath\}" token to refer to the built-in Powerlines plugins directory - the value will be replaced with the correct file path by the plugin.
29
- *
30
- * @defaultValue "\{builtinPath\}/content"
31
- */
32
- outputPath?: string;
33
- }
34
- type ContentCollectionsPluginUserConfig = UserConfig & {
35
- contentCollections?: ContentCollectionsPluginOptions;
36
- };
37
- type ContentCollectionsPluginResolvedConfig = ResolvedConfig & {
38
- contentCollections: Required<Omit<ContentCollectionsPluginOptions, "outputPath">> & Pick<ContentCollectionsPluginOptions, "outputPath">;
39
- };
40
- type ContentCollectionsPluginContext<TResolvedConfig extends ContentCollectionsPluginResolvedConfig = ContentCollectionsPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
41
- contentCollections: ContentCollectionsContext;
42
- };
43
- declare type __ΩContentCollectionsContext = any[];
44
- declare type __ΩContentCollectionsPluginOptions = any[];
45
- declare type __ΩContentCollectionsPluginUserConfig = any[];
46
- declare type __ΩContentCollectionsPluginResolvedConfig = any[];
47
- declare type __ΩContentCollectionsPluginContext = any[];
48
- //#endregion
49
- export { ContentCollectionsPluginUserConfig as a, __ΩContentCollectionsPluginOptions as c, ContentCollectionsPluginResolvedConfig as i, __ΩContentCollectionsPluginResolvedConfig as l, ContentCollectionsPluginContext as n, __ΩContentCollectionsContext as o, ContentCollectionsPluginOptions as r, __ΩContentCollectionsPluginContext as s, ContentCollectionsContext as t, __ΩContentCollectionsPluginUserConfig as u };
50
- //# sourceMappingURL=plugin-B8NELjmq.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-B8NELjmq.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"}
File without changes
@@ -1,50 +0,0 @@
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";
5
-
6
- //#region src/types/plugin.d.ts
7
- type ContentCollectionsContext = Pick<Awaited<ReturnType<typeof createInternalBuilder>>, "build" | "on"> & {
8
- context: BuildContext;
9
- };
10
- interface ContentCollectionsPluginOptions {
11
- /**
12
- * The path to a custom Prisma configuration file.
13
- *
14
- * @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.
16
- *
17
- * @defaultValue "\{projectRoot\}/content-collections.ts"
18
- */
19
- configFile?: string;
20
- /**
21
- * The list of content collections to include.
22
- */
23
- collections?: AnyCollection[];
24
- /**
25
- * The path to the content collection output files generated by the plugin.
26
- *
27
- * @remarks
28
- * If using the default value, the file can be imported from "powerlines:content/collection-name". This field allows the use of the "\{builtinPath\}" token to refer to the built-in Powerlines plugins directory - the value will be replaced with the correct file path by the plugin.
29
- *
30
- * @defaultValue "\{builtinPath\}/content"
31
- */
32
- outputPath?: string;
33
- }
34
- type ContentCollectionsPluginUserConfig = UserConfig & {
35
- contentCollections?: ContentCollectionsPluginOptions;
36
- };
37
- type ContentCollectionsPluginResolvedConfig = ResolvedConfig & {
38
- contentCollections: Required<Omit<ContentCollectionsPluginOptions, "outputPath">> & Pick<ContentCollectionsPluginOptions, "outputPath">;
39
- };
40
- type ContentCollectionsPluginContext<TResolvedConfig extends ContentCollectionsPluginResolvedConfig = ContentCollectionsPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
41
- contentCollections: ContentCollectionsContext;
42
- };
43
- declare type __ΩContentCollectionsContext = any[];
44
- declare type __ΩContentCollectionsPluginOptions = any[];
45
- declare type __ΩContentCollectionsPluginUserConfig = any[];
46
- declare type __ΩContentCollectionsPluginResolvedConfig = any[];
47
- declare type __ΩContentCollectionsPluginContext = any[];
48
- //#endregion
49
- export { ContentCollectionsPluginUserConfig as a, __ΩContentCollectionsPluginOptions as c, ContentCollectionsPluginResolvedConfig as i, __ΩContentCollectionsPluginResolvedConfig as l, ContentCollectionsPluginContext as n, __ΩContentCollectionsContext as o, ContentCollectionsPluginOptions as r, __ΩContentCollectionsPluginContext as s, ContentCollectionsContext as t, __ΩContentCollectionsPluginUserConfig as u };
50
- //# sourceMappingURL=plugin-sUSM5ZDl.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-sUSM5ZDl.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 +0,0 @@
1
- export { };
File without changes