@powerlines/plugin-content-collections 0.1.122 → 0.1.124

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 (66) 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 +28 -1
  4. package/dist/helpers/create-emitter.d.mts +28 -1
  5. package/dist/helpers/create-emitter.mjs +30 -1
  6. package/dist/helpers/create-writer.cjs +40 -2
  7. package/dist/helpers/create-writer.d.cts +12 -2
  8. package/dist/helpers/create-writer.d.mts +12 -2
  9. package/dist/helpers/create-writer.mjs +37 -1
  10. package/dist/helpers/index.cjs +4 -5
  11. package/dist/helpers/index.d.cts +2 -4
  12. package/dist/helpers/index.d.mts +2 -4
  13. package/dist/helpers/index.mjs +2 -3
  14. package/dist/index.cjs +12 -45
  15. package/dist/index.d.cts +4 -5
  16. package/dist/index.d.mts +6 -5
  17. package/dist/index.mjs +4 -38
  18. package/dist/powerlines/src/lib/utilities/file-header.cjs +13 -0
  19. package/dist/powerlines/src/lib/utilities/file-header.mjs +12 -0
  20. package/dist/powerlines/src/plugin-utils/paths.cjs +36 -0
  21. package/dist/powerlines/src/plugin-utils/paths.mjs +35 -0
  22. package/dist/powerlines/src/types/build.d.cts +145 -0
  23. package/dist/powerlines/src/types/build.d.mts +145 -0
  24. package/dist/powerlines/src/types/commands.d.cts +8 -0
  25. package/dist/powerlines/src/types/commands.d.mts +8 -0
  26. package/dist/powerlines/src/types/config.d.cts +376 -0
  27. package/dist/powerlines/src/types/config.d.mts +376 -0
  28. package/dist/powerlines/src/types/context.d.cts +403 -0
  29. package/dist/powerlines/src/types/context.d.mts +403 -0
  30. package/dist/powerlines/src/types/fs.d.cts +486 -0
  31. package/dist/powerlines/src/types/fs.d.mts +486 -0
  32. package/dist/powerlines/src/types/plugin.d.cts +231 -0
  33. package/dist/powerlines/src/types/plugin.d.mts +231 -0
  34. package/dist/powerlines/src/types/resolved.d.cts +81 -0
  35. package/dist/powerlines/src/types/resolved.d.mts +81 -0
  36. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  37. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  38. package/dist/types/index.cjs +0 -2
  39. package/dist/types/index.d.cts +1 -2
  40. package/dist/types/index.d.mts +1 -2
  41. package/dist/types/index.mjs +0 -3
  42. package/dist/types/plugin.cjs +0 -1
  43. package/dist/types/plugin.d.cts +48 -1
  44. package/dist/types/plugin.d.mts +48 -1
  45. package/dist/types/plugin.mjs +0 -2
  46. package/package.json +5 -5
  47. package/dist/create-emitter-Bk1iruR0.d.cts +0 -29
  48. package/dist/create-emitter-Ccqc-tkP.d.mts +0 -29
  49. package/dist/create-emitter-CdX9SXDY.mjs +0 -32
  50. package/dist/create-emitter-D5ApNfU0.cjs +0 -38
  51. package/dist/create-writer-Bd1D32Qr.d.cts +0 -13
  52. package/dist/create-writer-Du15htg7.mjs +0 -48
  53. package/dist/create-writer-Dz3qETzl.d.mts +0 -13
  54. package/dist/create-writer-gvbqS_Gu.cjs +0 -87
  55. package/dist/helpers-y2jvHwgF.mjs +0 -1
  56. package/dist/helpers-yB1XkvQI.cjs +0 -0
  57. package/dist/index-BL32-cvv.d.cts +0 -1
  58. package/dist/index-BR1oNnaF.d.cts +0 -1
  59. package/dist/index-Bk0eNZmQ.d.mts +0 -1
  60. package/dist/index-DNLi60D-.d.mts +0 -1
  61. package/dist/plugin-B0q2kj8i.mjs +0 -1
  62. package/dist/plugin-CNYP7gBR.d.cts +0 -1793
  63. package/dist/plugin-Ckx8qAq8.cjs +0 -0
  64. package/dist/plugin-XODpqmNI.d.mts +0 -1793
  65. package/dist/types--fVOUYBq.mjs +0 -1
  66. package/dist/types-a8gm_IaQ.cjs +0 -0
@@ -0,0 +1,69 @@
1
+ import { CompilerOptions, TsConfigJson } from "@stryke/types/tsconfig";
2
+ import ts from "typescript";
3
+
4
+ //#region ../powerlines/src/types/tsconfig.d.ts
5
+ type ReflectionMode = "default" | "explicit" | "never";
6
+ type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
7
+ /**
8
+ * Defines the level of reflection to be used during the transpilation process.
9
+ *
10
+ * @remarks
11
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
12
+ * - `minimal` - Only the essential type information is captured.
13
+ * - `normal` - Additional type information is captured, including some contextual data.
14
+ * - `verbose` - All available type information is captured, including detailed contextual data.
15
+ */
16
+ type ReflectionLevel = "minimal" | "normal" | "verbose";
17
+ interface DeepkitOptions {
18
+ /**
19
+ * Either true to activate reflection for all files compiled using this tsconfig,
20
+ * or a list of globs/file paths relative to this tsconfig.json.
21
+ * Globs/file paths can be prefixed with a ! to exclude them.
22
+ */
23
+ reflection?: RawReflectionMode;
24
+ /**
25
+ * Defines the level of reflection to be used during the transpilation process.
26
+ *
27
+ * @remarks
28
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
29
+ * - `minimal` - Only the essential type information is captured.
30
+ * - `normal` - Additional type information is captured, including some contextual data.
31
+ * - `verbose` - All available type information is captured, including detailed contextual data.
32
+ */
33
+ reflectionLevel?: ReflectionLevel;
34
+ }
35
+ type TSCompilerOptions = CompilerOptions & DeepkitOptions;
36
+ /**
37
+ * The TypeScript compiler configuration.
38
+ *
39
+ * @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
40
+ */
41
+ interface TSConfig extends Omit<TsConfigJson, "reflection"> {
42
+ /**
43
+ * Either true to activate reflection for all files compiled using this tsconfig,
44
+ * or a list of globs/file paths relative to this tsconfig.json.
45
+ * Globs/file paths can be prefixed with a ! to exclude them.
46
+ */
47
+ reflection?: RawReflectionMode;
48
+ /**
49
+ * Defines the level of reflection to be used during the transpilation process.
50
+ *
51
+ * @remarks
52
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
53
+ * - `minimal` - Only the essential type information is captured.
54
+ * - `normal` - Additional type information is captured, including some contextual data.
55
+ * - `verbose` - All available type information is captured, including detailed contextual data.
56
+ */
57
+ reflectionLevel?: ReflectionLevel;
58
+ /**
59
+ * Instructs the TypeScript compiler how to compile `.ts` files.
60
+ */
61
+ compilerOptions?: TSCompilerOptions;
62
+ }
63
+ type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
64
+ originalTsconfigJson: TsConfigJson;
65
+ tsconfigJson: TSConfig;
66
+ tsconfigFilePath: string;
67
+ };
68
+ //#endregion
69
+ export { ParsedTypeScriptConfig, TSConfig };
@@ -0,0 +1,69 @@
1
+ import { CompilerOptions, TsConfigJson } from "@stryke/types/tsconfig";
2
+ import ts from "typescript";
3
+
4
+ //#region ../powerlines/src/types/tsconfig.d.ts
5
+ type ReflectionMode = "default" | "explicit" | "never";
6
+ type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
7
+ /**
8
+ * Defines the level of reflection to be used during the transpilation process.
9
+ *
10
+ * @remarks
11
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
12
+ * - `minimal` - Only the essential type information is captured.
13
+ * - `normal` - Additional type information is captured, including some contextual data.
14
+ * - `verbose` - All available type information is captured, including detailed contextual data.
15
+ */
16
+ type ReflectionLevel = "minimal" | "normal" | "verbose";
17
+ interface DeepkitOptions {
18
+ /**
19
+ * Either true to activate reflection for all files compiled using this tsconfig,
20
+ * or a list of globs/file paths relative to this tsconfig.json.
21
+ * Globs/file paths can be prefixed with a ! to exclude them.
22
+ */
23
+ reflection?: RawReflectionMode;
24
+ /**
25
+ * Defines the level of reflection to be used during the transpilation process.
26
+ *
27
+ * @remarks
28
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
29
+ * - `minimal` - Only the essential type information is captured.
30
+ * - `normal` - Additional type information is captured, including some contextual data.
31
+ * - `verbose` - All available type information is captured, including detailed contextual data.
32
+ */
33
+ reflectionLevel?: ReflectionLevel;
34
+ }
35
+ type TSCompilerOptions = CompilerOptions & DeepkitOptions;
36
+ /**
37
+ * The TypeScript compiler configuration.
38
+ *
39
+ * @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
40
+ */
41
+ interface TSConfig extends Omit<TsConfigJson, "reflection"> {
42
+ /**
43
+ * Either true to activate reflection for all files compiled using this tsconfig,
44
+ * or a list of globs/file paths relative to this tsconfig.json.
45
+ * Globs/file paths can be prefixed with a ! to exclude them.
46
+ */
47
+ reflection?: RawReflectionMode;
48
+ /**
49
+ * Defines the level of reflection to be used during the transpilation process.
50
+ *
51
+ * @remarks
52
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
53
+ * - `minimal` - Only the essential type information is captured.
54
+ * - `normal` - Additional type information is captured, including some contextual data.
55
+ * - `verbose` - All available type information is captured, including detailed contextual data.
56
+ */
57
+ reflectionLevel?: ReflectionLevel;
58
+ /**
59
+ * Instructs the TypeScript compiler how to compile `.ts` files.
60
+ */
61
+ compilerOptions?: TSCompilerOptions;
62
+ }
63
+ type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
64
+ originalTsconfigJson: TsConfigJson;
65
+ tsconfigJson: TSConfig;
66
+ tsconfigFilePath: string;
67
+ };
68
+ //#endregion
69
+ export { ParsedTypeScriptConfig, TSConfig };
@@ -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-CNYP7gBR.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-XODpqmNI.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,49 @@
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-CNYP7gBR.cjs";
1
+ import { ResolvedConfig } from "../powerlines/src/types/resolved.cjs";
2
+ import { PluginContext } from "../powerlines/src/types/context.cjs";
3
+ import { UserConfig } from "../powerlines/src/types/config.cjs";
4
+ import { AnyCollection, BuildContext, createInternalBuilder } from "@content-collections/core";
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
2
49
  export { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig };
@@ -1,2 +1,49 @@
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-XODpqmNI.mjs";
1
+ import { ResolvedConfig } from "../powerlines/src/types/resolved.mjs";
2
+ import { PluginContext } from "../powerlines/src/types/context.mjs";
3
+ import { UserConfig } from "../powerlines/src/types/config.mjs";
4
+ import { AnyCollection, BuildContext, createInternalBuilder } from "@content-collections/core";
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
2
49
  export { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig };
@@ -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.122",
3
+ "version": "0.1.124",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin to generate project code using Content Collections.",
6
6
  "repository": {
@@ -130,15 +130,15 @@
130
130
  "@stryke/types": "^0.10.29",
131
131
  "defu": "^6.1.4",
132
132
  "pluralize": "^8.0.0",
133
- "powerlines": "^0.36.26"
133
+ "powerlines": "^0.36.28"
134
134
  },
135
135
  "devDependencies": {
136
- "@powerlines/nx": "^0.11.52",
137
- "@powerlines/plugin-plugin": "^0.12.74",
136
+ "@powerlines/nx": "^0.11.54",
137
+ "@powerlines/plugin-plugin": "^0.12.76",
138
138
  "@standard-schema/spec": "^1.1.0",
139
139
  "@types/node": "^24.10.4",
140
140
  "@types/pluralize": "^0.0.33"
141
141
  },
142
142
  "publishConfig": { "access": "public" },
143
- "gitHead": "a703a2dd9be6175a67a9bf4847d0217be4e920af"
143
+ "gitHead": "6891ff1330798e807c4caef6134df09d9f57686d"
144
144
  }
@@ -1,29 +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 };
@@ -1,29 +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 };
@@ -1,32 +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 };
@@ -1,38 +0,0 @@
1
- const require_create_writer = require('./create-writer-gvbqS_Gu.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,13 +0,0 @@
1
- import { n as ContentCollectionsPluginContext } from "./plugin-CNYP7gBR.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 };
@@ -1,48 +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 { titleCase } from "@stryke/string-format/title-case";
6
-
7
- //#region ../powerlines/src/lib/utilities/file-header.ts
8
- function getBaseFileHeader(context) {
9
- return `
10
- // Generated with ${titleCase(context.config.framework)}
11
- // Note: Do not edit this file manually - it will be overwritten automatically
12
- `;
13
- }
14
-
15
- //#endregion
16
- //#region src/helpers/create-writer.ts
17
- const createConstName = (name) => {
18
- return pluralize(name.charAt(0).toUpperCase() + name.slice(1));
19
- };
20
- const createArrayConstName = (name) => {
21
- return `all${createConstName(name)}`;
22
- };
23
- /**
24
- *
25
- * @param context - The Powerlines build plugin
26
- * @returns
27
- */
28
- const createWriter = (context) => {
29
- return {
30
- createJavaScriptFile: async (configuration) => {
31
- return context.emitBuiltin(`${getBaseFileHeader(context)}
32
- ${configuration.collections.map(({ name }) => `import ${createArrayConstName(name)} from "./${kebabCase(name)}";`).join("\n")}
33
-
34
- export { ${configuration.collections.map(({ name }) => createArrayConstName(name)).join(", ")} };
35
- `, "content");
36
- },
37
- createTypeDefinitionFile: async (_) => Promise.resolve(),
38
- createDataFiles: async (collections) => {
39
- await Promise.all(collections.map(async (collection) => {
40
- if (context.config.contentCollections.outputPath) return context.fs.write(joinPaths(context.config.contentCollections.outputPath, kebabCase(collection.name)), serialize(collection.documents.map((doc) => doc.document)));
41
- return context.emitBuiltin(serialize(collection.documents.map((doc) => doc.document)), joinPaths("content", kebabCase(collection.name)));
42
- }));
43
- }
44
- };
45
- };
46
-
47
- //#endregion
48
- export { createWriter as t };
@@ -1,13 +0,0 @@
1
- import { n as ContentCollectionsPluginContext } from "./plugin-XODpqmNI.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 };
@@ -1,87 +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 __stryke_string_format_title_case = require("@stryke/string-format/title-case");
34
-
35
- //#region ../powerlines/src/lib/utilities/file-header.ts
36
- function getBaseFileHeader(context) {
37
- return `
38
- // Generated with ${(0, __stryke_string_format_title_case.titleCase)(context.config.framework)}
39
- // Note: Do not edit this file manually - it will be overwritten automatically
40
- `;
41
- }
42
-
43
- //#endregion
44
- //#region src/helpers/create-writer.ts
45
- const createConstName = (name) => {
46
- return (0, pluralize.default)(name.charAt(0).toUpperCase() + name.slice(1));
47
- };
48
- const createArrayConstName = (name) => {
49
- return `all${createConstName(name)}`;
50
- };
51
- /**
52
- *
53
- * @param context - The Powerlines build plugin
54
- * @returns
55
- */
56
- const createWriter = (context) => {
57
- return {
58
- createJavaScriptFile: async (configuration) => {
59
- return context.emitBuiltin(`${getBaseFileHeader(context)}
60
- ${configuration.collections.map(({ name }) => `import ${createArrayConstName(name)} from "./${(0, __stryke_string_format_kebab_case.kebabCase)(name)}";`).join("\n")}
61
-
62
- export { ${configuration.collections.map(({ name }) => createArrayConstName(name)).join(", ")} };
63
- `, "content");
64
- },
65
- createTypeDefinitionFile: async (_) => Promise.resolve(),
66
- createDataFiles: async (collections) => {
67
- await Promise.all(collections.map(async (collection) => {
68
- 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)));
69
- 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)));
70
- }));
71
- }
72
- };
73
- };
74
-
75
- //#endregion
76
- Object.defineProperty(exports, '__toESM', {
77
- enumerable: true,
78
- get: function () {
79
- return __toESM;
80
- }
81
- });
82
- Object.defineProperty(exports, 'createWriter', {
83
- enumerable: true,
84
- get: function () {
85
- return createWriter;
86
- }
87
- });
@@ -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 { };