@rsbuild/shared
Advanced tools
Comparing version 0.4.8 to 0.4.9
@@ -307,3 +307,2 @@ "use strict"; | ||
const config = api.getNormalizedConfig(); | ||
const jsPath = (0, import_fs.getDistPath)(config, "js"); | ||
const publicPath = getPublicPath({ | ||
@@ -314,4 +313,6 @@ config, | ||
}); | ||
const jsPath = (0, import_fs.getDistPath)(config, "js"); | ||
const jsAsyncPath = (0, import_fs.getDistPath)(config, "jsAsync"); | ||
const jsFilename = (0, import_fs.getFilename)(config, "js", isProd); | ||
chain.output.path(api.context.distPath).filename(import_node_path.posix.join(jsPath, jsFilename)).chunkFilename(import_node_path.posix.join(jsPath, `async/${jsFilename}`)).publicPath(publicPath).pathinfo(false).hashFunction("xxhash64"); | ||
chain.output.path(api.context.distPath).filename(import_node_path.posix.join(jsPath, jsFilename)).chunkFilename(import_node_path.posix.join(jsAsyncPath, jsFilename)).publicPath(publicPath).pathinfo(false).hashFunction("xxhash64"); | ||
if (isServer) { | ||
@@ -318,0 +319,0 @@ const serverPath = (0, import_fs.getDistPath)(config, "server"); |
@@ -48,2 +48,10 @@ "use strict"; | ||
if (typeof ret !== "string") { | ||
if (type === "jsAsync") { | ||
const jsPath = getDistPath(config, "js"); | ||
return jsPath ? `${jsPath}/async` : "async"; | ||
} | ||
if (type === "cssAsync") { | ||
const cssPath = getDistPath(config, "css"); | ||
return cssPath ? `${cssPath}/async` : "async"; | ||
} | ||
throw new Error(`unknown key ${type} in "output.distPath"`); | ||
@@ -50,0 +58,0 @@ } |
export * from './constants'; | ||
export * from './createHook'; | ||
export * from './utils'; | ||
@@ -8,3 +7,2 @@ export * from './fs'; | ||
export * from './mergeChainedOptions'; | ||
export * from './mergeRsbuildConfig'; | ||
export * from './types'; | ||
@@ -11,0 +9,0 @@ export * from './config'; |
@@ -19,3 +19,2 @@ "use strict"; | ||
__reExport(src_exports, require("./constants"), module.exports); | ||
__reExport(src_exports, require("./createHook"), module.exports); | ||
__reExport(src_exports, require("./utils"), module.exports); | ||
@@ -26,3 +25,2 @@ __reExport(src_exports, require("./fs"), module.exports); | ||
__reExport(src_exports, require("./mergeChainedOptions"), module.exports); | ||
__reExport(src_exports, require("./mergeRsbuildConfig"), module.exports); | ||
__reExport(src_exports, require("./types"), module.exports); | ||
@@ -39,3 +37,2 @@ __reExport(src_exports, require("./config"), module.exports); | ||
...require("./constants"), | ||
...require("./createHook"), | ||
...require("./utils"), | ||
@@ -46,3 +43,2 @@ ...require("./fs"), | ||
...require("./mergeChainedOptions"), | ||
...require("./mergeRsbuildConfig"), | ||
...require("./types"), | ||
@@ -49,0 +45,0 @@ ...require("./config"), |
@@ -5,37 +5,102 @@ import type { RspackConfig } from '../rspack'; | ||
export type DistPathConfig = { | ||
/** The root directory of all files. */ | ||
/** | ||
* The root directory of all files. | ||
* @default 'dist' | ||
**/ | ||
root?: string; | ||
/** The output directory of JavaScript files. */ | ||
/** | ||
* The output directory of JavaScript files. | ||
* @default 'static/js' | ||
*/ | ||
js?: string; | ||
/** The output directory of CSS style files. */ | ||
/** | ||
* The output directory of async JavaScript files. | ||
* @default 'static/js/async' | ||
*/ | ||
jsAsync?: string; | ||
/** | ||
* The output directory of CSS files. | ||
* @default 'static/css' | ||
*/ | ||
css?: string; | ||
/** The output directory of SVG images. */ | ||
/** | ||
* The output directory of async CSS files. | ||
* @default 'static/css/async' | ||
*/ | ||
cssAsync?: string; | ||
/** | ||
* The output directory of SVG images. | ||
* @default 'static/svg' | ||
*/ | ||
svg?: string; | ||
/** The output directory of font files. */ | ||
/** | ||
* The output directory of font files. | ||
* @default 'static/font' | ||
*/ | ||
font?: string; | ||
/** The output directory of HTML files. */ | ||
/** | ||
* The output directory of HTML files. | ||
* @default '/' | ||
*/ | ||
html?: string; | ||
/** The output directory of Wasm files. */ | ||
/** | ||
* The output directory of Wasm files. | ||
* @default 'static/wasm' | ||
*/ | ||
wasm?: string; | ||
/** The output directory of non-SVG images. */ | ||
/** | ||
* The output directory of non-SVG images. | ||
* @default 'static/image' | ||
*/ | ||
image?: string; | ||
/** The output directory of media resources, such as videos. */ | ||
/** | ||
* The output directory of media resources, such as videos. | ||
* @default 'static/media' | ||
*/ | ||
media?: string; | ||
/** The output directory of server bundles when target is `node`. */ | ||
/** | ||
* The output directory of server bundles when target is `node`. | ||
* @default 'server' | ||
*/ | ||
server?: string; | ||
/** The output directory of service worker bundles when target is `service-worker`. */ | ||
/** | ||
* The output directory of service worker bundles when target is `service-worker`. | ||
* @default 'worker' | ||
*/ | ||
worker?: string; | ||
}; | ||
export type FilenameConfig = { | ||
/** The name of the JavaScript file. */ | ||
/** | ||
* The name of the JavaScript files. | ||
* @default | ||
* - dev: '[name].js' | ||
* - prod: '[name].[contenthash:8].js' | ||
*/ | ||
js?: string; | ||
/** The name of the CSS style file. */ | ||
/** | ||
* The name of the CSS files. | ||
* @default | ||
* - dev: '[name].css' | ||
* - prod: '[name].[contenthash:8].css' | ||
*/ | ||
css?: string; | ||
/** The name of the SVG image. */ | ||
/** | ||
* The name of the SVG images. | ||
* @default '[name].[contenthash:8].svg' | ||
*/ | ||
svg?: string; | ||
/** The name of the font file. */ | ||
/** | ||
* The name of the font files. | ||
* @default '[name].[contenthash:8][ext]' | ||
*/ | ||
font?: string; | ||
/** The name of a non-SVG image. */ | ||
/** | ||
* The name of non-SVG images. | ||
* @default '[name].[contenthash:8][ext]' | ||
*/ | ||
image?: string; | ||
/** The name of a media resource, such as a video. */ | ||
/** | ||
* The name of media assets, such as video. | ||
* @default '[name].[contenthash:8][ext]' | ||
*/ | ||
media?: string; | ||
@@ -42,0 +107,0 @@ }; |
@@ -6,3 +6,2 @@ import type { ChainIdentifier } from '../chain'; | ||
import type { BundlerChain } from './bundlerConfig'; | ||
import type { mergeRsbuildConfig } from '../mergeRsbuildConfig'; | ||
import type { Rspack, RspackConfig } from './rspack'; | ||
@@ -45,3 +44,3 @@ import type { RsbuildConfig } from './config'; | ||
/** Merge multiple Rsbuild config objects into one. */ | ||
mergeRsbuildConfig: typeof mergeRsbuildConfig; | ||
mergeRsbuildConfig: (...configs: RsbuildConfig[]) => RsbuildConfig; | ||
}; | ||
@@ -48,0 +47,0 @@ export type ModifyRsbuildConfigFn = (config: RsbuildConfig, utils: ModifyRsbuildConfigUtils) => PromiseOrNot<RsbuildConfig | void>; |
@@ -9,3 +9,11 @@ import type { Falsy, WebpackChain } from './utils'; | ||
import type { ChainIdentifier } from '../chain'; | ||
import type { HookDescriptor } from '../createHook'; | ||
type HookOrder = 'pre' | 'post' | 'default'; | ||
export type HookDescriptor<T extends (...args: any[]) => any> = { | ||
handler: T; | ||
order: HookOrder; | ||
}; | ||
export type AsyncHook<Callback extends (...args: any[]) => any> = { | ||
tap: (cb: Callback | HookDescriptor<Callback>) => void; | ||
call: (...args: Parameters<Callback>) => Promise<Parameters<Callback>>; | ||
}; | ||
export type ModifyRspackConfigFn = (config: RspackConfig, utils: ModifyRspackConfigUtils) => Promise<RspackConfig | void> | RspackConfig | void; | ||
@@ -12,0 +20,0 @@ export type ModifyWebpackChainUtils = ModifyChainUtils & { |
@@ -31,3 +31,3 @@ /// <reference types="node" /> | ||
export declare const awaitableGetter: <T>(promises: Promise<T>[]) => AwaitableGetter<T>; | ||
export declare const getJsSourceMap: (config: NormalizedConfig) => false | "cheap-module-source-map" | "eval" | "cheap-source-map" | "source-map" | "inline-cheap-source-map" | "inline-cheap-module-source-map" | "inline-source-map" | "inline-nosources-cheap-source-map" | "inline-nosources-cheap-module-source-map" | "inline-nosources-source-map" | "nosources-cheap-source-map" | "nosources-cheap-module-source-map" | "nosources-source-map" | "hidden-nosources-cheap-source-map" | "hidden-nosources-cheap-module-source-map" | "hidden-nosources-source-map" | "hidden-cheap-source-map" | "hidden-cheap-module-source-map" | "hidden-source-map" | "eval-cheap-source-map" | "eval-cheap-module-source-map" | "eval-source-map" | "eval-nosources-cheap-source-map" | "eval-nosources-cheap-module-source-map" | "eval-nosources-source-map"; | ||
export declare const getJsSourceMap: (config: NormalizedConfig) => false | "eval" | "cheap-source-map" | "cheap-module-source-map" | "source-map" | "inline-cheap-source-map" | "inline-cheap-module-source-map" | "inline-source-map" | "inline-nosources-cheap-source-map" | "inline-nosources-cheap-module-source-map" | "inline-nosources-source-map" | "nosources-cheap-source-map" | "nosources-cheap-module-source-map" | "nosources-source-map" | "hidden-nosources-cheap-source-map" | "hidden-nosources-cheap-module-source-map" | "hidden-nosources-source-map" | "hidden-cheap-source-map" | "hidden-cheap-module-source-map" | "hidden-source-map" | "eval-cheap-source-map" | "eval-cheap-module-source-map" | "eval-source-map" | "eval-nosources-cheap-source-map" | "eval-nosources-cheap-module-source-map" | "eval-nosources-source-map"; | ||
export declare const getSharedPkgCompiledPath: (packageName: SharedCompiledPkgNames) => string; | ||
@@ -34,0 +34,0 @@ export declare const isURL: (str: string) => boolean; |
{ | ||
"name": "@rsbuild/shared", | ||
"version": "0.4.8", | ||
"version": "0.4.9", | ||
"description": "The internal shared modules and dependencies of Rsbuild.", | ||
@@ -133,3 +133,3 @@ "homepage": "https://rsbuild.dev", | ||
"html-webpack-plugin": "npm:html-rspack-plugin@5.6.1", | ||
"mini-css-extract-plugin": "2.8.0", | ||
"mini-css-extract-plugin": "2.8.1", | ||
"terser": "5.28.1", | ||
@@ -136,0 +136,0 @@ "terser-webpack-plugin": "5.3.10", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7713528
283
22949