balm-core 6.0.0-alpha.2 → 6.0.0-alpha.4
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/CHANGELOG.md +25 -0
- package/dist/index.cjs +559 -224
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -3
- package/dist/index.d.ts +42 -3
- package/dist/index.js +540 -210
- package/dist/index.js.map +1 -1
- package/package.json +38 -1
- package/src/balm.ts +0 -107
- package/src/bundler/esbuild.ts +0 -48
- package/src/bundler/index.ts +0 -3
- package/src/bundler/rollup.ts +0 -46
- package/src/bundler/webpack.ts +0 -125
- package/src/config/constants.ts +0 -12
- package/src/config/defaults.ts +0 -212
- package/src/config/index.ts +0 -112
- package/src/hooks/index.ts +0 -224
- package/src/index.ts +0 -16
- package/src/pipeline/file.ts +0 -69
- package/src/pipeline/index.ts +0 -10
- package/src/pipeline/pipeline.ts +0 -135
- package/src/pipeline/transforms/cache.ts +0 -147
- package/src/pipeline/transforms/htmlmin.ts +0 -18
- package/src/pipeline/transforms/less.ts +0 -75
- package/src/pipeline/transforms/postcss.ts +0 -43
- package/src/pipeline/transforms/rename.ts +0 -38
- package/src/pipeline/transforms/replace.ts +0 -30
- package/src/pipeline/transforms/sass.ts +0 -106
- package/src/pipeline/transforms/terser.ts +0 -20
- package/src/runner/dag.ts +0 -77
- package/src/runner/task.ts +0 -38
- package/src/shims.d.ts +0 -5
- package/src/tasks/cache.ts +0 -84
- package/src/tasks/clean.ts +0 -21
- package/src/tasks/copy.ts +0 -36
- package/src/tasks/ftp.ts +0 -90
- package/src/tasks/html.ts +0 -290
- package/src/tasks/index.ts +0 -14
- package/src/tasks/publish.ts +0 -71
- package/src/tasks/pwa.ts +0 -86
- package/src/tasks/remove.ts +0 -24
- package/src/tasks/replace.ts +0 -34
- package/src/tasks/script.ts +0 -28
- package/src/tasks/server.ts +0 -218
- package/src/tasks/static.ts +0 -77
- package/src/tasks/style.ts +0 -57
- package/src/tasks/zip.ts +0 -77
- package/src/types/index.ts +0 -225
- package/src/utilities/file.ts +0 -140
- package/src/utilities/logger.ts +0 -63
- package/src/utilities/utils.ts +0 -46
- package/src/utilities/workspace.ts +0 -38
- package/src/watcher/index.ts +0 -100
- package/tsconfig.json +0 -8
- package/tsup.config.ts +0 -12
package/dist/index.d.cts
CHANGED
|
@@ -69,6 +69,19 @@ interface BalmScripts {
|
|
|
69
69
|
js?: boolean;
|
|
70
70
|
url?: boolean;
|
|
71
71
|
};
|
|
72
|
+
includeJsResource: string[];
|
|
73
|
+
excludeUrlResource: string[];
|
|
74
|
+
useEsModule: boolean;
|
|
75
|
+
urlLoaderOptions: Record<string, any>;
|
|
76
|
+
babelLoaderOptions: Record<string, any>;
|
|
77
|
+
htmlLoaderOptions: Record<string, any>;
|
|
78
|
+
postcssLoaderOptions: Record<string, any>;
|
|
79
|
+
sourceMap: boolean | string;
|
|
80
|
+
stats?: any;
|
|
81
|
+
optimization: Record<string, any>;
|
|
82
|
+
extractAllVendors: boolean;
|
|
83
|
+
vendorName: string;
|
|
84
|
+
extractCss: boolean;
|
|
72
85
|
options: Record<string, any>;
|
|
73
86
|
esbuildOptions: Record<string, any>;
|
|
74
87
|
rollupOptions: Record<string, any>;
|
|
@@ -109,6 +122,10 @@ interface BalmAssets {
|
|
|
109
122
|
static?: string;
|
|
110
123
|
[key: string]: any;
|
|
111
124
|
}
|
|
125
|
+
interface BalmExtras {
|
|
126
|
+
includes?: string[];
|
|
127
|
+
excludes?: string[];
|
|
128
|
+
}
|
|
112
129
|
interface ServeStaticOption {
|
|
113
130
|
route?: string;
|
|
114
131
|
dir: string | string[];
|
|
@@ -172,6 +189,7 @@ interface BalmConfig {
|
|
|
172
189
|
scripts: BalmScripts;
|
|
173
190
|
html: BalmHtml;
|
|
174
191
|
assets: BalmAssets;
|
|
192
|
+
extras?: BalmExtras;
|
|
175
193
|
server: BalmServer;
|
|
176
194
|
pwa: BalmPwa;
|
|
177
195
|
ftp: BalmFtp;
|
|
@@ -280,8 +298,8 @@ declare class BalmHooks {
|
|
|
280
298
|
declare class Balm {
|
|
281
299
|
private _config;
|
|
282
300
|
private dag;
|
|
283
|
-
beforeTask?: () => Promise<void> | void;
|
|
284
|
-
afterTask?: () => Promise<void> | void;
|
|
301
|
+
beforeTask?: (config: BalmConfig) => Promise<void> | void;
|
|
302
|
+
afterTask?: (config: BalmConfig) => Promise<void> | void;
|
|
285
303
|
readonly Bundler: typeof BundlerType;
|
|
286
304
|
constructor();
|
|
287
305
|
get config(): BalmConfig;
|
|
@@ -400,6 +418,27 @@ declare class AssetRevisioner {
|
|
|
400
418
|
process(files: VirtualFile[]): VirtualFile[];
|
|
401
419
|
}
|
|
402
420
|
|
|
421
|
+
declare function shouldUseTargetPaths(config: BalmConfig): boolean;
|
|
422
|
+
/**
|
|
423
|
+
* Check whether a file is the configured PWA manifest or a `.webmanifest` file.
|
|
424
|
+
*/
|
|
425
|
+
declare function isManifestFile(file: {
|
|
426
|
+
basename: string;
|
|
427
|
+
extname: string;
|
|
428
|
+
}, config: BalmConfig): boolean;
|
|
429
|
+
/**
|
|
430
|
+
* Rewrite relative (`../<source>/`) and root-relative (`url(/<source>/)`)
|
|
431
|
+
* asset URLs in compiled stylesheets from source folder names to target folder
|
|
432
|
+
* names when building for production or backend integration.
|
|
433
|
+
*/
|
|
434
|
+
declare function rewriteCssAssetUrls(content: string, config: BalmConfig): string;
|
|
435
|
+
/**
|
|
436
|
+
* Rewrite source directory segments (e.g. `/images/`, `"styles/`) to target
|
|
437
|
+
* directory names in HTML and PWA manifest files.
|
|
438
|
+
*/
|
|
439
|
+
declare function rewriteHtmlAssetPaths(content: string, config: BalmConfig): string;
|
|
440
|
+
declare function transformCssUrl(config: BalmConfig): TransformFn;
|
|
441
|
+
|
|
403
442
|
declare function runWebpack(config: BalmConfig, customOptions?: Configuration): Promise<webpack.Stats | undefined>;
|
|
404
443
|
|
|
405
444
|
declare function runRollup(config: BalmConfig, customInputOptions?: RollupOptions, customOutputOptions?: OutputOptions): Promise<void>;
|
|
@@ -586,4 +625,4 @@ declare function globalWorkspace(subPath?: string): string;
|
|
|
586
625
|
declare const localResolve: typeof localWorkspace;
|
|
587
626
|
declare const globalResolve: typeof globalWorkspace;
|
|
588
627
|
|
|
589
|
-
export { ASSET, ASSETS_TYPES, ASSET_EXT, type AnalyticsOptions, AssetRevisioner, Balm, type BalmAssets, type BalmConfig, type BalmCustomConfig, type BalmEntry, type BalmEnv, type BalmFtp, BalmHooks, type BalmHtml, type BalmImages, type BalmPathMap, type BalmPaths, type BalmPwa, type BalmRoots, type BalmScripts, type BalmServer, type BalmStyles, type BalmWorkspaceConfig, type BalmWorkspaces, BaseTask, BundlerType, CHUNK, CacheTask, type CacheTransformOptions, CleanTask, CopyTask, type CopyTaskOptions, type CustomAnalyticsOptions, type DeepPartial, FileSystem, FtpTask, type FtpTaskOptions, FunctionTask, HtmlTask, type LessTransformOptions, LogLevel, type LooseObject, PUBLIC_URL, Pipeline, type PipelineOptions, type PostcssTransformOptions, PublishTask, type PublishTaskOptions, PwaTask, type PwaTaskOptions, RemoveTask, type RenameOptions, type ReplaceOptions, ReplaceTask, type ReplaceTaskOptions, type SassTransformOptions, ScriptTask, type ServeStaticItem, type ServeStaticOption, ServerTask, StaticTask, StyleTask, type TaskContext, TaskDAG, type TaskFn, type TaskOptions, type TemplateOption, type TransformFn, VirtualFile, type VirtualFileOptions, type WorkspacePaths, ZipTask, type ZipTaskOptions, balm, createDefaultConfig, deepMerge, balm as default, file, getWorkspaces, globalResolve, globalWorkspace, isArray, isBoolean, isFunction, isObject, isString, localResolve, localWorkspace, logger, resolveConfig, resolveDefaultEntry, runEsbuild, runRollup, runWebpack, setWorkspaces, toNamespace, transformHtmlmin, transformLess, transformPostcss, transformRename, transformReplace, transformSass, transformTerser };
|
|
628
|
+
export { ASSET, ASSETS_TYPES, ASSET_EXT, type AnalyticsOptions, AssetRevisioner, Balm, type BalmAssets, type BalmConfig, type BalmCustomConfig, type BalmEntry, type BalmEnv, type BalmExtras, type BalmFtp, BalmHooks, type BalmHtml, type BalmImages, type BalmPathMap, type BalmPaths, type BalmPwa, type BalmRoots, type BalmScripts, type BalmServer, type BalmStyles, type BalmWorkspaceConfig, type BalmWorkspaces, BaseTask, BundlerType, CHUNK, CacheTask, type CacheTransformOptions, CleanTask, CopyTask, type CopyTaskOptions, type CustomAnalyticsOptions, type DeepPartial, FileSystem, FtpTask, type FtpTaskOptions, FunctionTask, HtmlTask, type LessTransformOptions, LogLevel, type LooseObject, PUBLIC_URL, Pipeline, type PipelineOptions, type PostcssTransformOptions, PublishTask, type PublishTaskOptions, PwaTask, type PwaTaskOptions, RemoveTask, type RenameOptions, type ReplaceOptions, ReplaceTask, type ReplaceTaskOptions, type SassTransformOptions, ScriptTask, type ServeStaticItem, type ServeStaticOption, ServerTask, StaticTask, StyleTask, type TaskContext, TaskDAG, type TaskFn, type TaskOptions, type TemplateOption, type TransformFn, VirtualFile, type VirtualFileOptions, type WorkspacePaths, ZipTask, type ZipTaskOptions, balm, createDefaultConfig, deepMerge, balm as default, file, getWorkspaces, globalResolve, globalWorkspace, isArray, isBoolean, isFunction, isManifestFile, isObject, isString, localResolve, localWorkspace, logger, resolveConfig, resolveDefaultEntry, rewriteCssAssetUrls, rewriteHtmlAssetPaths, runEsbuild, runRollup, runWebpack, setWorkspaces, shouldUseTargetPaths, toNamespace, transformCssUrl, transformHtmlmin, transformLess, transformPostcss, transformRename, transformReplace, transformSass, transformTerser };
|
package/dist/index.d.ts
CHANGED
|
@@ -69,6 +69,19 @@ interface BalmScripts {
|
|
|
69
69
|
js?: boolean;
|
|
70
70
|
url?: boolean;
|
|
71
71
|
};
|
|
72
|
+
includeJsResource: string[];
|
|
73
|
+
excludeUrlResource: string[];
|
|
74
|
+
useEsModule: boolean;
|
|
75
|
+
urlLoaderOptions: Record<string, any>;
|
|
76
|
+
babelLoaderOptions: Record<string, any>;
|
|
77
|
+
htmlLoaderOptions: Record<string, any>;
|
|
78
|
+
postcssLoaderOptions: Record<string, any>;
|
|
79
|
+
sourceMap: boolean | string;
|
|
80
|
+
stats?: any;
|
|
81
|
+
optimization: Record<string, any>;
|
|
82
|
+
extractAllVendors: boolean;
|
|
83
|
+
vendorName: string;
|
|
84
|
+
extractCss: boolean;
|
|
72
85
|
options: Record<string, any>;
|
|
73
86
|
esbuildOptions: Record<string, any>;
|
|
74
87
|
rollupOptions: Record<string, any>;
|
|
@@ -109,6 +122,10 @@ interface BalmAssets {
|
|
|
109
122
|
static?: string;
|
|
110
123
|
[key: string]: any;
|
|
111
124
|
}
|
|
125
|
+
interface BalmExtras {
|
|
126
|
+
includes?: string[];
|
|
127
|
+
excludes?: string[];
|
|
128
|
+
}
|
|
112
129
|
interface ServeStaticOption {
|
|
113
130
|
route?: string;
|
|
114
131
|
dir: string | string[];
|
|
@@ -172,6 +189,7 @@ interface BalmConfig {
|
|
|
172
189
|
scripts: BalmScripts;
|
|
173
190
|
html: BalmHtml;
|
|
174
191
|
assets: BalmAssets;
|
|
192
|
+
extras?: BalmExtras;
|
|
175
193
|
server: BalmServer;
|
|
176
194
|
pwa: BalmPwa;
|
|
177
195
|
ftp: BalmFtp;
|
|
@@ -280,8 +298,8 @@ declare class BalmHooks {
|
|
|
280
298
|
declare class Balm {
|
|
281
299
|
private _config;
|
|
282
300
|
private dag;
|
|
283
|
-
beforeTask?: () => Promise<void> | void;
|
|
284
|
-
afterTask?: () => Promise<void> | void;
|
|
301
|
+
beforeTask?: (config: BalmConfig) => Promise<void> | void;
|
|
302
|
+
afterTask?: (config: BalmConfig) => Promise<void> | void;
|
|
285
303
|
readonly Bundler: typeof BundlerType;
|
|
286
304
|
constructor();
|
|
287
305
|
get config(): BalmConfig;
|
|
@@ -400,6 +418,27 @@ declare class AssetRevisioner {
|
|
|
400
418
|
process(files: VirtualFile[]): VirtualFile[];
|
|
401
419
|
}
|
|
402
420
|
|
|
421
|
+
declare function shouldUseTargetPaths(config: BalmConfig): boolean;
|
|
422
|
+
/**
|
|
423
|
+
* Check whether a file is the configured PWA manifest or a `.webmanifest` file.
|
|
424
|
+
*/
|
|
425
|
+
declare function isManifestFile(file: {
|
|
426
|
+
basename: string;
|
|
427
|
+
extname: string;
|
|
428
|
+
}, config: BalmConfig): boolean;
|
|
429
|
+
/**
|
|
430
|
+
* Rewrite relative (`../<source>/`) and root-relative (`url(/<source>/)`)
|
|
431
|
+
* asset URLs in compiled stylesheets from source folder names to target folder
|
|
432
|
+
* names when building for production or backend integration.
|
|
433
|
+
*/
|
|
434
|
+
declare function rewriteCssAssetUrls(content: string, config: BalmConfig): string;
|
|
435
|
+
/**
|
|
436
|
+
* Rewrite source directory segments (e.g. `/images/`, `"styles/`) to target
|
|
437
|
+
* directory names in HTML and PWA manifest files.
|
|
438
|
+
*/
|
|
439
|
+
declare function rewriteHtmlAssetPaths(content: string, config: BalmConfig): string;
|
|
440
|
+
declare function transformCssUrl(config: BalmConfig): TransformFn;
|
|
441
|
+
|
|
403
442
|
declare function runWebpack(config: BalmConfig, customOptions?: Configuration): Promise<webpack.Stats | undefined>;
|
|
404
443
|
|
|
405
444
|
declare function runRollup(config: BalmConfig, customInputOptions?: RollupOptions, customOutputOptions?: OutputOptions): Promise<void>;
|
|
@@ -586,4 +625,4 @@ declare function globalWorkspace(subPath?: string): string;
|
|
|
586
625
|
declare const localResolve: typeof localWorkspace;
|
|
587
626
|
declare const globalResolve: typeof globalWorkspace;
|
|
588
627
|
|
|
589
|
-
export { ASSET, ASSETS_TYPES, ASSET_EXT, type AnalyticsOptions, AssetRevisioner, Balm, type BalmAssets, type BalmConfig, type BalmCustomConfig, type BalmEntry, type BalmEnv, type BalmFtp, BalmHooks, type BalmHtml, type BalmImages, type BalmPathMap, type BalmPaths, type BalmPwa, type BalmRoots, type BalmScripts, type BalmServer, type BalmStyles, type BalmWorkspaceConfig, type BalmWorkspaces, BaseTask, BundlerType, CHUNK, CacheTask, type CacheTransformOptions, CleanTask, CopyTask, type CopyTaskOptions, type CustomAnalyticsOptions, type DeepPartial, FileSystem, FtpTask, type FtpTaskOptions, FunctionTask, HtmlTask, type LessTransformOptions, LogLevel, type LooseObject, PUBLIC_URL, Pipeline, type PipelineOptions, type PostcssTransformOptions, PublishTask, type PublishTaskOptions, PwaTask, type PwaTaskOptions, RemoveTask, type RenameOptions, type ReplaceOptions, ReplaceTask, type ReplaceTaskOptions, type SassTransformOptions, ScriptTask, type ServeStaticItem, type ServeStaticOption, ServerTask, StaticTask, StyleTask, type TaskContext, TaskDAG, type TaskFn, type TaskOptions, type TemplateOption, type TransformFn, VirtualFile, type VirtualFileOptions, type WorkspacePaths, ZipTask, type ZipTaskOptions, balm, createDefaultConfig, deepMerge, balm as default, file, getWorkspaces, globalResolve, globalWorkspace, isArray, isBoolean, isFunction, isObject, isString, localResolve, localWorkspace, logger, resolveConfig, resolveDefaultEntry, runEsbuild, runRollup, runWebpack, setWorkspaces, toNamespace, transformHtmlmin, transformLess, transformPostcss, transformRename, transformReplace, transformSass, transformTerser };
|
|
628
|
+
export { ASSET, ASSETS_TYPES, ASSET_EXT, type AnalyticsOptions, AssetRevisioner, Balm, type BalmAssets, type BalmConfig, type BalmCustomConfig, type BalmEntry, type BalmEnv, type BalmExtras, type BalmFtp, BalmHooks, type BalmHtml, type BalmImages, type BalmPathMap, type BalmPaths, type BalmPwa, type BalmRoots, type BalmScripts, type BalmServer, type BalmStyles, type BalmWorkspaceConfig, type BalmWorkspaces, BaseTask, BundlerType, CHUNK, CacheTask, type CacheTransformOptions, CleanTask, CopyTask, type CopyTaskOptions, type CustomAnalyticsOptions, type DeepPartial, FileSystem, FtpTask, type FtpTaskOptions, FunctionTask, HtmlTask, type LessTransformOptions, LogLevel, type LooseObject, PUBLIC_URL, Pipeline, type PipelineOptions, type PostcssTransformOptions, PublishTask, type PublishTaskOptions, PwaTask, type PwaTaskOptions, RemoveTask, type RenameOptions, type ReplaceOptions, ReplaceTask, type ReplaceTaskOptions, type SassTransformOptions, ScriptTask, type ServeStaticItem, type ServeStaticOption, ServerTask, StaticTask, StyleTask, type TaskContext, TaskDAG, type TaskFn, type TaskOptions, type TemplateOption, type TransformFn, VirtualFile, type VirtualFileOptions, type WorkspacePaths, ZipTask, type ZipTaskOptions, balm, createDefaultConfig, deepMerge, balm as default, file, getWorkspaces, globalResolve, globalWorkspace, isArray, isBoolean, isFunction, isManifestFile, isObject, isString, localResolve, localWorkspace, logger, resolveConfig, resolveDefaultEntry, rewriteCssAssetUrls, rewriteHtmlAssetPaths, runEsbuild, runRollup, runWebpack, setWorkspaces, shouldUseTargetPaths, toNamespace, transformCssUrl, transformHtmlmin, transformLess, transformPostcss, transformRename, transformReplace, transformSass, transformTerser };
|