@powerlines/plugin-content-collections 0.1.58 → 0.1.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/rolldown_runtime.cjs +1 -0
- package/dist/helpers/create-emitter.cjs +1 -1
- package/dist/helpers/create-emitter.d.cts +28 -1
- package/dist/helpers/create-emitter.d.mts +28 -1
- package/dist/helpers/create-emitter.mjs +1 -1
- package/dist/helpers/create-writer.cjs +6 -1
- package/dist/helpers/create-writer.d.cts +12 -2
- package/dist/helpers/create-writer.d.mts +12 -2
- package/dist/helpers/create-writer.mjs +6 -1
- package/dist/helpers/index.cjs +1 -1
- package/dist/helpers/index.d.cts +2 -4
- package/dist/helpers/index.d.mts +2 -4
- package/dist/helpers/index.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -5
- package/dist/index.d.mts +6 -5
- package/dist/index.mjs +1 -1
- package/dist/powerlines/src/lib/utilities/file-header.cjs +4 -0
- package/dist/powerlines/src/lib/utilities/file-header.mjs +4 -0
- package/dist/powerlines/src/plugin-utils/paths.cjs +1 -0
- package/dist/powerlines/src/plugin-utils/paths.mjs +1 -0
- package/dist/powerlines/src/types/build.d.cts +139 -0
- package/dist/powerlines/src/types/build.d.mts +139 -0
- package/dist/powerlines/src/types/commands.d.cts +8 -0
- package/dist/powerlines/src/types/commands.d.mts +8 -0
- package/dist/powerlines/src/types/config.d.cts +345 -0
- package/dist/powerlines/src/types/config.d.mts +345 -0
- package/dist/powerlines/src/types/context.d.cts +347 -0
- package/dist/powerlines/src/types/context.d.mts +347 -0
- package/dist/powerlines/src/types/fs.d.cts +458 -0
- package/dist/powerlines/src/types/fs.d.mts +458 -0
- package/dist/powerlines/src/types/plugin.d.cts +232 -0
- package/dist/powerlines/src/types/plugin.d.mts +232 -0
- package/dist/powerlines/src/types/resolved.d.cts +81 -0
- package/dist/powerlines/src/types/resolved.d.mts +81 -0
- package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
- package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
- package/dist/types/index.cjs +0 -1
- package/dist/types/index.d.cts +1 -2
- package/dist/types/index.d.mts +1 -2
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.cjs +0 -1
- package/dist/types/plugin.d.cts +48 -1
- package/dist/types/plugin.d.mts +48 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +10 -10
- package/dist/create-emitter-Bk1iruR0.d.cts +0 -29
- package/dist/create-emitter-Ccqc-tkP.d.mts +0 -29
- package/dist/create-emitter-D2D-OWFH.mjs +0 -1
- package/dist/create-emitter-D5prAv7U.cjs +0 -1
- package/dist/create-writer-BUb6uBji.mjs +0 -9
- package/dist/create-writer-DzFEUkBv.d.mts +0 -13
- package/dist/create-writer-kXziZJhg.d.cts +0 -13
- package/dist/create-writer-v6g9eZ0E.cjs +0 -9
- package/dist/helpers-DLqVzgm5.mjs +0 -1
- package/dist/helpers-yB1XkvQI.cjs +0 -0
- package/dist/index-BL32-cvv.d.cts +0 -1
- package/dist/index-BR1oNnaF.d.cts +0 -1
- package/dist/index-Bk0eNZmQ.d.mts +0 -1
- package/dist/index-DNLi60D-.d.mts +0 -1
- package/dist/plugin-B0OXXzdJ.d.mts +0 -1680
- package/dist/plugin-ChVhLKb1.d.cts +0 -1680
- package/dist/plugin-Ckx8qAq8.cjs +0 -0
- package/dist/plugin-G4qbpIjB.mjs +0 -1
- package/dist/types-CSNCwSXh.mjs +0 -1
- package/dist/types-a8gm_IaQ.cjs +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`node:events`);function n(){let e=new t.EventEmitter;function n(t,n){e.on(t,n)}function r(t,n){e.emit(t,n),typeof n==`object`&&n&&`error`in n&&e.emit(`_error`,{...n,_event:t}),e.emit(`_all`,{...n,_event:t})}return{on:n,emit:r}}exports.createEmitter=n;
|
|
@@ -1,2 +1,29 @@
|
|
|
1
|
-
|
|
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
|
|
2
29
|
export { createEmitter };
|
|
@@ -1,2 +1,29 @@
|
|
|
1
|
-
|
|
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
|
|
2
29
|
export { createEmitter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{EventEmitter as e}from"node:events";function t(){let t=new e;function n(e,n){t.on(e,n)}function r(e,n){t.emit(e,n),typeof n==`object`&&n&&`error`in n&&t.emit(`_error`,{...n,_event:e}),t.emit(`_all`,{...n,_event:e})}return{on:n,emit:r}}export{t as createEmitter};
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
const e=require(`../
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../powerlines/src/lib/utilities/file-header.cjs`);let n=require(`@content-collections/core`),r=require(`@stryke/path/join-paths`),i=require(`@stryke/string-format/kebab-case`),a=require(`pluralize`);a=e.__toESM(a);const o=e=>(0,a.default)(e.charAt(0).toUpperCase()+e.slice(1)),s=e=>`all${o(e)}`,c=e=>({createJavaScriptFile:async n=>e.emitBuiltin(`${t.getBaseFileHeader(e)}
|
|
2
|
+
${n.collections.map(({name:e})=>`import ${s(e)} from "./${(0,i.kebabCase)(e)}";`).join(`
|
|
3
|
+
`)}
|
|
4
|
+
|
|
5
|
+
export { ${n.collections.map(({name:e})=>s(e)).join(`, `)} };
|
|
6
|
+
`,`content`),createTypeDefinitionFile:async e=>Promise.resolve(),createDataFiles:async t=>{await Promise.all(t.map(async t=>e.config.contentCollections.outputPath?e.fs.write((0,r.joinPaths)(e.config.contentCollections.outputPath,(0,i.kebabCase)(t.name)),(0,n.serialize)(t.documents.map(e=>e.document))):e.emitBuiltin((0,n.serialize)(t.documents.map(e=>e.document)),(0,r.joinPaths)(`content`,(0,i.kebabCase)(t.name)))))}});exports.createWriter=c;
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
import "../plugin
|
|
2
|
-
import {
|
|
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
|
|
3
13
|
export { createWriter };
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
import "../plugin
|
|
2
|
-
import {
|
|
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
|
|
3
13
|
export { createWriter };
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getBaseFileHeader as e}from"../powerlines/src/lib/utilities/file-header.mjs";import{serialize as t}from"@content-collections/core";import{joinPaths as n}from"@stryke/path/join-paths";import{kebabCase as r}from"@stryke/string-format/kebab-case";import i from"pluralize";const a=e=>i(e.charAt(0).toUpperCase()+e.slice(1)),o=e=>`all${a(e)}`,s=i=>({createJavaScriptFile:async t=>i.emitBuiltin(`${e(i)}
|
|
2
|
+
${t.collections.map(({name:e})=>`import ${o(e)} from "./${r(e)}";`).join(`
|
|
3
|
+
`)}
|
|
4
|
+
|
|
5
|
+
export { ${t.collections.map(({name:e})=>o(e)).join(`, `)} };
|
|
6
|
+
`,`content`),createTypeDefinitionFile:async e=>Promise.resolve(),createDataFiles:async e=>{await Promise.all(e.map(async e=>i.config.contentCollections.outputPath?i.fs.write(n(i.config.contentCollections.outputPath,r(e.name)),t(e.documents.map(e=>e.document))):i.emitBuiltin(t(e.documents.map(e=>e.document)),n(`content`,r(e.name)))))}});export{s as createWriter};
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(
|
|
1
|
+
const e=require(`./create-emitter.cjs`),t=require(`./create-writer.cjs`);exports.createEmitter=e.createEmitter,exports.createWriter=t.createWriter;
|
package/dist/helpers/index.d.cts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import { t as createWriter } from "../create-writer-kXziZJhg.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 };
|
package/dist/helpers/index.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import { t as createWriter } from "../create-writer-DzFEUkBv.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 };
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{createEmitter as e}from"./create-emitter.mjs";import{createWriter as t}from"./create-writer.mjs";export{e as createEmitter,t as createWriter};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./
|
|
1
|
+
Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./powerlines/src/plugin-utils/paths.cjs`),n=require(`./helpers/create-emitter.cjs`),r=require(`./helpers/create-writer.cjs`);require(`./helpers/index.cjs`);let i=require(`@content-collections/core`),a=require(`@stryke/fs/exists`),o=require(`@stryke/path/join`),s=require(`defu`);s=e.__toESM(s);let c=require(`node:crypto`);const l=e=>({name:`content-collections`,config(){return{contentCollections:(0,s.default)(e,{configFile:`{projectRoot}/content-collections.ts`,collections:[]})}},async configResolved(){this.config.contentCollections.configFile||=t.replacePathTokens(this,this.config.contentCollections.configFile),this.config.contentCollections.outputPath||=t.replacePathTokens(this,this.config.contentCollections.outputPath);let e=n.createEmitter(),l=(0,i.createConfigurationReader)(),u={};try{(0,a.existsSync)(this.config.contentCollections.configFile)&&(u=await l(this.config.contentCollections.configFile,{configName:`config.mjs`,cacheDir:(0,o.joinPaths)(this.cachePath,`content-collections`)}))}catch{}u=(0,s.default)(u??{},this.config.contentCollections),u.checksum=(0,c.createHash)(`sha256`).update(JSON.stringify(u)).digest(`hex`);let d=await(0,i.createBuildContext)({emitter:e,baseDirectory:(0,o.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot),outputDirectory:this.config.contentCollections.outputPath||(0,o.joinPaths)(this.builtinsPath,`content`),configuration:u});d.writer=r.createWriter(this),this.contentCollections={context:d,build:async()=>(0,i.build)(d),on:e.on}},async prepare(){return this.contentCollections.build()}});var u=l;exports.createEmitter=n.createEmitter,exports.createWriter=r.createWriter,exports.default=u,exports.plugin=l;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
5
|
-
import "./index-BL32-cvv.cjs";
|
|
1
|
+
import { createEmitter } from "./helpers/create-emitter.cjs";
|
|
2
|
+
import { Plugin } from "./powerlines/src/types/plugin.cjs";
|
|
3
|
+
import { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig } from "./types/plugin.cjs";
|
|
4
|
+
import { createWriter } from "./helpers/create-writer.cjs";
|
|
6
5
|
|
|
7
6
|
//#region src/index.d.ts
|
|
8
7
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
5
|
-
import "./index
|
|
1
|
+
import { createEmitter } from "./helpers/create-emitter.mjs";
|
|
2
|
+
import { Plugin } from "./powerlines/src/types/plugin.mjs";
|
|
3
|
+
import { ContentCollectionsContext, ContentCollectionsPluginContext, ContentCollectionsPluginOptions, ContentCollectionsPluginResolvedConfig, ContentCollectionsPluginUserConfig, __ΩContentCollectionsContext, __ΩContentCollectionsPluginContext, __ΩContentCollectionsPluginOptions, __ΩContentCollectionsPluginResolvedConfig, __ΩContentCollectionsPluginUserConfig } from "./types/plugin.mjs";
|
|
4
|
+
import { createWriter } from "./helpers/create-writer.mjs";
|
|
5
|
+
import "./helpers/index.mjs";
|
|
6
|
+
import "./types/index.mjs";
|
|
6
7
|
|
|
7
8
|
//#region src/index.d.ts
|
|
8
9
|
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{replacePathTokens as e}from"./powerlines/src/plugin-utils/paths.mjs";import{createEmitter as t}from"./helpers/create-emitter.mjs";import{createWriter as n}from"./helpers/create-writer.mjs";import"./helpers/index.mjs";import{build as r,createBuildContext as i,createConfigurationReader as a}from"@content-collections/core";import{existsSync as o}from"@stryke/fs/exists";import{joinPaths as s}from"@stryke/path/join";import c from"defu";import{createHash as l}from"node:crypto";const u=u=>({name:`content-collections`,config(){return{contentCollections:c(u,{configFile:`{projectRoot}/content-collections.ts`,collections:[]})}},async configResolved(){this.config.contentCollections.configFile||=e(this,this.config.contentCollections.configFile),this.config.contentCollections.outputPath||=e(this,this.config.contentCollections.outputPath);let u=t(),d=a(),f={};try{o(this.config.contentCollections.configFile)&&(f=await d(this.config.contentCollections.configFile,{configName:`config.mjs`,cacheDir:s(this.cachePath,`content-collections`)}))}catch{}f=c(f??{},this.config.contentCollections),f.checksum=l(`sha256`).update(JSON.stringify(f)).digest(`hex`);let p=await i({emitter:u,baseDirectory:s(this.workspaceConfig.workspaceRoot,this.config.projectRoot),outputDirectory:this.config.contentCollections.outputPath||s(this.builtinsPath,`content`),configuration:f});p.writer=n(this),this.contentCollections={context:p,build:async()=>r(p),on:u.on}},async prepare(){return this.contentCollections.build()}});var d=u;export{t as createEmitter,n as createWriter,d as default,u as plugin};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/string-format/title-case`);function n(e){return`
|
|
2
|
+
// Generated with ${(0,t.titleCase)(e.config.framework)}
|
|
3
|
+
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
4
|
+
`}exports.getBaseFileHeader=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/replace`);function n(e,n){return n&&n.replaceAll(`{workspaceRoot}`,e.workspaceConfig.workspaceRoot).replaceAll(`{root}`,e.config.projectRoot).replaceAll(`{projectRoot}`,e.config.projectRoot).replaceAll(`{sourceRoot}`,e.config.sourceRoot).replaceAll(`{powerlinesPath}`,e.powerlinesPath).replaceAll(`{cachePath}`,e.cachePath).replaceAll(`{dataPath}`,e.dataPath).replaceAll(`{logPath}`,e.envPaths.log).replaceAll(`{tempPath}`,e.envPaths.temp).replaceAll(`{configPath}`,e.envPaths.config).replaceAll(`{outputPath}`,e.config.output.outputPath).replaceAll(`{buildPath}`,e.config.output.buildPath).replaceAll(`{artifactsPath}`,(0,t.replacePath)(e.artifactsPath,e.workspaceConfig.workspaceRoot)).replaceAll(`{builtinPath}`,(0,t.replacePath)(e.builtinsPath,e.workspaceConfig.workspaceRoot)).replaceAll(`{entryPath}`,(0,t.replacePath)(e.entryPath,e.workspaceConfig.workspaceRoot))}exports.replacePathTokens=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{replacePath as e}from"@stryke/path/replace";function t(t,n){return n&&n.replaceAll(`{workspaceRoot}`,t.workspaceConfig.workspaceRoot).replaceAll(`{root}`,t.config.projectRoot).replaceAll(`{projectRoot}`,t.config.projectRoot).replaceAll(`{sourceRoot}`,t.config.sourceRoot).replaceAll(`{powerlinesPath}`,t.powerlinesPath).replaceAll(`{cachePath}`,t.cachePath).replaceAll(`{dataPath}`,t.dataPath).replaceAll(`{logPath}`,t.envPaths.log).replaceAll(`{tempPath}`,t.envPaths.temp).replaceAll(`{configPath}`,t.envPaths.config).replaceAll(`{outputPath}`,t.config.output.outputPath).replaceAll(`{buildPath}`,t.config.output.buildPath).replaceAll(`{artifactsPath}`,e(t.artifactsPath,t.workspaceConfig.workspaceRoot)).replaceAll(`{builtinPath}`,e(t.builtinsPath,t.workspaceConfig.workspaceRoot)).replaceAll(`{entryPath}`,e(t.entryPath,t.workspaceConfig.workspaceRoot))}export{t as replacePathTokens};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
//#region ../powerlines/src/types/build.d.ts
|
|
2
|
+
|
|
3
|
+
type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
|
|
4
|
+
interface BuildConfig {
|
|
5
|
+
/**
|
|
6
|
+
* The platform to build the project for
|
|
7
|
+
*
|
|
8
|
+
* @defaultValue "neutral"
|
|
9
|
+
*/
|
|
10
|
+
platform?: "node" | "browser" | "neutral";
|
|
11
|
+
/**
|
|
12
|
+
* Array of strings indicating the polyfills to include for the build.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* This option allows you to specify which polyfills should be included in the build process to ensure compatibility with the target environment. The paths for the polyfills can use placeholder tokens (the `replacePathTokens` helper function will be used to resolve the actual values).
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* {
|
|
20
|
+
* polyfill: ['{projectRoot}/custom-polyfill.ts']
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
polyfill?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
|
|
27
|
+
*
|
|
28
|
+
* @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
|
|
29
|
+
*/
|
|
30
|
+
mainFields?: string[];
|
|
31
|
+
/**
|
|
32
|
+
* Array of strings indicating what conditions should be used for module resolution.
|
|
33
|
+
*/
|
|
34
|
+
conditions?: string[];
|
|
35
|
+
/**
|
|
36
|
+
* Array of strings indicating what file extensions should be used for module resolution.
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
|
|
39
|
+
*/
|
|
40
|
+
extensions?: string[];
|
|
41
|
+
/**
|
|
42
|
+
* Array of strings indicating what modules should be deduplicated to a single version in the build.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
|
|
46
|
+
*/
|
|
47
|
+
dedupe?: string[];
|
|
48
|
+
/**
|
|
49
|
+
* Array of strings or regular expressions that indicate what modules are builtin for the environment.
|
|
50
|
+
*/
|
|
51
|
+
builtins?: (string | RegExp)[];
|
|
52
|
+
/**
|
|
53
|
+
* Define global variable replacements.
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* This option allows you to specify global constants that will be replaced in the code during the build process. It is similar to the `define` option in esbuild and Vite, enabling you to replace specific identifiers with constant expressions at build time.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* {
|
|
61
|
+
* define: {
|
|
62
|
+
* __VERSION__: '"1.0.0"',
|
|
63
|
+
* __DEV__: 'process.env.NODE_ENV !== "production"'
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @see https://esbuild.github.io/api/#define
|
|
69
|
+
* @see https://vitejs.dev/config/build-options.html#define
|
|
70
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/replace
|
|
71
|
+
*/
|
|
72
|
+
define?: Record<string, any>;
|
|
73
|
+
/**
|
|
74
|
+
* Global variables that will have import statements injected where necessary
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* This option allows you to specify global variables that should be automatically imported from specified modules whenever they are used in the code. This is particularly useful for polyfilling Node.js globals in a browser environment.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* {
|
|
82
|
+
* inject: {
|
|
83
|
+
* process: 'process/browser',
|
|
84
|
+
* Buffer: ['buffer', 'Buffer'],
|
|
85
|
+
* }
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/inject
|
|
90
|
+
*/
|
|
91
|
+
inject?: Record<string, string | string[]>;
|
|
92
|
+
/**
|
|
93
|
+
* The alias mappings to use for module resolution during the build process.
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* This option allows you to define custom path aliases for modules, which can be useful for simplifying imports and managing dependencies.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* {
|
|
101
|
+
* alias: {
|
|
102
|
+
* "@utils": "./src/utils",
|
|
103
|
+
* "@components": "./src/components"
|
|
104
|
+
* }
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/alias
|
|
109
|
+
*/
|
|
110
|
+
alias?: Record<string, string> | Array<{
|
|
111
|
+
find: string | RegExp;
|
|
112
|
+
replacement: string;
|
|
113
|
+
}>;
|
|
114
|
+
/**
|
|
115
|
+
* A list of modules that should not be bundled, even if they are external dependencies.
|
|
116
|
+
*
|
|
117
|
+
* @remarks
|
|
118
|
+
* This option is useful for excluding specific modules from the bundle, such as Node.js built-in modules or other libraries that should not be bundled.
|
|
119
|
+
*/
|
|
120
|
+
external?: (string | RegExp)[];
|
|
121
|
+
/**
|
|
122
|
+
* A list of modules that should always be bundled, even if they are external dependencies.
|
|
123
|
+
*/
|
|
124
|
+
noExternal?: (string | RegExp)[];
|
|
125
|
+
/**
|
|
126
|
+
* Should the Powerlines CLI processes skip bundling the `node_modules` directory?
|
|
127
|
+
*/
|
|
128
|
+
skipNodeModulesBundle?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* An optional set of override options to apply to the selected build variant.
|
|
131
|
+
*
|
|
132
|
+
* @remarks
|
|
133
|
+
* This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
|
|
134
|
+
*/
|
|
135
|
+
override?: Record<string, any>;
|
|
136
|
+
}
|
|
137
|
+
type BuildResolvedConfig = Omit<BuildConfig, "override">;
|
|
138
|
+
//#endregion
|
|
139
|
+
export { BuildConfig, BuildResolvedConfig, UnpluginBuildVariant };
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
//#region ../powerlines/src/types/build.d.ts
|
|
2
|
+
|
|
3
|
+
type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
|
|
4
|
+
interface BuildConfig {
|
|
5
|
+
/**
|
|
6
|
+
* The platform to build the project for
|
|
7
|
+
*
|
|
8
|
+
* @defaultValue "neutral"
|
|
9
|
+
*/
|
|
10
|
+
platform?: "node" | "browser" | "neutral";
|
|
11
|
+
/**
|
|
12
|
+
* Array of strings indicating the polyfills to include for the build.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* This option allows you to specify which polyfills should be included in the build process to ensure compatibility with the target environment. The paths for the polyfills can use placeholder tokens (the `replacePathTokens` helper function will be used to resolve the actual values).
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* {
|
|
20
|
+
* polyfill: ['{projectRoot}/custom-polyfill.ts']
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
polyfill?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
|
|
27
|
+
*
|
|
28
|
+
* @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
|
|
29
|
+
*/
|
|
30
|
+
mainFields?: string[];
|
|
31
|
+
/**
|
|
32
|
+
* Array of strings indicating what conditions should be used for module resolution.
|
|
33
|
+
*/
|
|
34
|
+
conditions?: string[];
|
|
35
|
+
/**
|
|
36
|
+
* Array of strings indicating what file extensions should be used for module resolution.
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
|
|
39
|
+
*/
|
|
40
|
+
extensions?: string[];
|
|
41
|
+
/**
|
|
42
|
+
* Array of strings indicating what modules should be deduplicated to a single version in the build.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
|
|
46
|
+
*/
|
|
47
|
+
dedupe?: string[];
|
|
48
|
+
/**
|
|
49
|
+
* Array of strings or regular expressions that indicate what modules are builtin for the environment.
|
|
50
|
+
*/
|
|
51
|
+
builtins?: (string | RegExp)[];
|
|
52
|
+
/**
|
|
53
|
+
* Define global variable replacements.
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* This option allows you to specify global constants that will be replaced in the code during the build process. It is similar to the `define` option in esbuild and Vite, enabling you to replace specific identifiers with constant expressions at build time.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* {
|
|
61
|
+
* define: {
|
|
62
|
+
* __VERSION__: '"1.0.0"',
|
|
63
|
+
* __DEV__: 'process.env.NODE_ENV !== "production"'
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @see https://esbuild.github.io/api/#define
|
|
69
|
+
* @see https://vitejs.dev/config/build-options.html#define
|
|
70
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/replace
|
|
71
|
+
*/
|
|
72
|
+
define?: Record<string, any>;
|
|
73
|
+
/**
|
|
74
|
+
* Global variables that will have import statements injected where necessary
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* This option allows you to specify global variables that should be automatically imported from specified modules whenever they are used in the code. This is particularly useful for polyfilling Node.js globals in a browser environment.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* {
|
|
82
|
+
* inject: {
|
|
83
|
+
* process: 'process/browser',
|
|
84
|
+
* Buffer: ['buffer', 'Buffer'],
|
|
85
|
+
* }
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/inject
|
|
90
|
+
*/
|
|
91
|
+
inject?: Record<string, string | string[]>;
|
|
92
|
+
/**
|
|
93
|
+
* The alias mappings to use for module resolution during the build process.
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* This option allows you to define custom path aliases for modules, which can be useful for simplifying imports and managing dependencies.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* {
|
|
101
|
+
* alias: {
|
|
102
|
+
* "@utils": "./src/utils",
|
|
103
|
+
* "@components": "./src/components"
|
|
104
|
+
* }
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/alias
|
|
109
|
+
*/
|
|
110
|
+
alias?: Record<string, string> | Array<{
|
|
111
|
+
find: string | RegExp;
|
|
112
|
+
replacement: string;
|
|
113
|
+
}>;
|
|
114
|
+
/**
|
|
115
|
+
* A list of modules that should not be bundled, even if they are external dependencies.
|
|
116
|
+
*
|
|
117
|
+
* @remarks
|
|
118
|
+
* This option is useful for excluding specific modules from the bundle, such as Node.js built-in modules or other libraries that should not be bundled.
|
|
119
|
+
*/
|
|
120
|
+
external?: (string | RegExp)[];
|
|
121
|
+
/**
|
|
122
|
+
* A list of modules that should always be bundled, even if they are external dependencies.
|
|
123
|
+
*/
|
|
124
|
+
noExternal?: (string | RegExp)[];
|
|
125
|
+
/**
|
|
126
|
+
* Should the Powerlines CLI processes skip bundling the `node_modules` directory?
|
|
127
|
+
*/
|
|
128
|
+
skipNodeModulesBundle?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* An optional set of override options to apply to the selected build variant.
|
|
131
|
+
*
|
|
132
|
+
* @remarks
|
|
133
|
+
* This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
|
|
134
|
+
*/
|
|
135
|
+
override?: Record<string, any>;
|
|
136
|
+
}
|
|
137
|
+
type BuildResolvedConfig = Omit<BuildConfig, "override">;
|
|
138
|
+
//#endregion
|
|
139
|
+
export { BuildConfig, BuildResolvedConfig, UnpluginBuildVariant };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
2
|
+
import { ArrayValues } from "@stryke/types/array";
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/types/commands.d.ts
|
|
5
|
+
declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
|
|
6
|
+
type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { CommandType };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
2
|
+
import { ArrayValues } from "@stryke/types/array";
|
|
3
|
+
|
|
4
|
+
//#region ../powerlines/src/types/commands.d.ts
|
|
5
|
+
declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
|
|
6
|
+
type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { CommandType };
|