@rsaf/bundler 0.0.5 → 0.0.7
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/bundler/config.d.ts +3 -3
- package/dist/bundler/config.js +0 -4
- package/dist/bundler/create-plugin.d.ts +8 -8
- package/dist/bundler/create-plugin.js +7 -9
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types/config.d.ts +4 -2
- package/dist/types/esbuild.d.ts +1 -0
- package/dist/types/esbuild.js +1 -0
- package/package.json +1 -1
package/dist/bundler/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ESBuildClientDevConfig, ESBuildClientProdConfig, ESBuildServerDevConfig, ESBuildServerProdConfig } from '../types/config.js';
|
|
1
|
+
import type { BuildEnv, ESBuildClientDevConfig, ESBuildClientProdConfig, ESBuildServerDevConfig, ESBuildServerProdConfig } from '../types/config.js';
|
|
2
2
|
/**
|
|
3
3
|
* Generates an esbuild configuration specifically for the Client (browser) environment.
|
|
4
4
|
* * @remarks
|
|
@@ -13,7 +13,7 @@ import type { ESBuildClientDevConfig, ESBuildClientProdConfig, ESBuildServerDevC
|
|
|
13
13
|
* @param options.entryPoints - File paths or a mapping for the entry points to be bundled.
|
|
14
14
|
* * @returns A configuration object typed for either {@link ESBuildClientDevConfig} or {@link ESBuildClientProdConfig}.
|
|
15
15
|
*/
|
|
16
|
-
export declare function createClientConfig(env:
|
|
16
|
+
export declare function createClientConfig(env: BuildEnv, options: {
|
|
17
17
|
absWorkingDir: string;
|
|
18
18
|
entryPoints: string[] | Record<string, string>;
|
|
19
19
|
}): ESBuildClientDevConfig | ESBuildClientProdConfig;
|
|
@@ -32,7 +32,7 @@ export declare function createClientConfig(env: 'dev' | 'prod', options: {
|
|
|
32
32
|
* @param options.entryPoints - File paths or a mapping for the entry points (e.g., the SSR entry).
|
|
33
33
|
* * @returns A configuration object typed for either {@link ESBuildServerDevConfig} or {@link ESBuildServerProdConfig}.
|
|
34
34
|
*/
|
|
35
|
-
export declare function createServerConfig(env:
|
|
35
|
+
export declare function createServerConfig(env: BuildEnv, options: {
|
|
36
36
|
absWorkingDir: string;
|
|
37
37
|
entryPoints: string[] | Record<string, string>;
|
|
38
38
|
}): ESBuildServerDevConfig | ESBuildServerProdConfig;
|
package/dist/bundler/config.js
CHANGED
|
@@ -101,7 +101,6 @@ export function createServerConfig(env, options) {
|
|
|
101
101
|
...NO_ASSET_LOADERS,
|
|
102
102
|
},
|
|
103
103
|
bundle: false,
|
|
104
|
-
packages: 'external',
|
|
105
104
|
minify: false,
|
|
106
105
|
minifyWhitespace: false,
|
|
107
106
|
minifyIdentifiers: false,
|
|
@@ -109,7 +108,6 @@ export function createServerConfig(env, options) {
|
|
|
109
108
|
write: false,
|
|
110
109
|
splitting: false,
|
|
111
110
|
metafile: true,
|
|
112
|
-
external: ['react', 'react-dom'],
|
|
113
111
|
};
|
|
114
112
|
}
|
|
115
113
|
else {
|
|
@@ -122,7 +120,6 @@ export function createServerConfig(env, options) {
|
|
|
122
120
|
...NO_ASSET_LOADERS,
|
|
123
121
|
},
|
|
124
122
|
bundle: false,
|
|
125
|
-
packages: 'external',
|
|
126
123
|
minify: true,
|
|
127
124
|
minifyWhitespace: true,
|
|
128
125
|
minifyIdentifiers: true,
|
|
@@ -130,7 +127,6 @@ export function createServerConfig(env, options) {
|
|
|
130
127
|
write: true,
|
|
131
128
|
splitting: true,
|
|
132
129
|
metafile: false,
|
|
133
|
-
external: ['react', 'react-dom'],
|
|
134
130
|
};
|
|
135
131
|
}
|
|
136
132
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BuildResult, OnLoadArgs, OnLoadOptions, OnResolveArgs, OnResolveOptions, Plugin, OnLoadResult, OnResolveResult
|
|
1
|
+
import type { BuildResult, OnLoadArgs, OnLoadOptions, OnResolveArgs, OnResolveOptions, Plugin, OnLoadResult, OnResolveResult } from 'esbuild';
|
|
2
2
|
/**
|
|
3
3
|
* Defines the execution logic for various stages of the esbuild bundling process.
|
|
4
4
|
* * This interface provides a structured, declarative way to tap into the
|
|
@@ -11,22 +11,22 @@ interface PluginLifecycleHooks {
|
|
|
11
11
|
* Use this for setup logic, initializing build-specific state, or clear/prepare output directories.
|
|
12
12
|
* If this function returns a `Promise`, esbuild will wait for it to resolve before starting the build.
|
|
13
13
|
*/
|
|
14
|
-
onStart?: (
|
|
14
|
+
onStart?: () => void | Promise<void>;
|
|
15
15
|
/**
|
|
16
16
|
* Invoked at the end of every build or rebuild.
|
|
17
|
-
*
|
|
17
|
+
* @param result - The outcome of the build, including errors, warnings, and the metafile (if enabled).
|
|
18
18
|
* @remarks
|
|
19
19
|
* Ideal for post-processing tasks, such as generating manifest files,
|
|
20
20
|
* triggering notifications, or cleaning up temporary files.
|
|
21
21
|
*/
|
|
22
|
-
onEnd?: (
|
|
22
|
+
onEnd?: (result: BuildResult) => void | Promise<void>;
|
|
23
23
|
/**
|
|
24
24
|
* Invoked when the plugin is disposed of, usually when the {@link Bundler.dispose} is called.
|
|
25
|
-
*
|
|
25
|
+
* @remarks
|
|
26
26
|
* Use this to close file watchers, database connections, or long-lived child processes
|
|
27
27
|
* created within the plugin.
|
|
28
28
|
*/
|
|
29
|
-
onDispose?: (
|
|
29
|
+
onDispose?: () => void;
|
|
30
30
|
/**
|
|
31
31
|
* Intercepts the loading of files that match specific criteria.
|
|
32
32
|
*/
|
|
@@ -76,10 +76,10 @@ interface PluginLifecycleHooks {
|
|
|
76
76
|
* }
|
|
77
77
|
* });
|
|
78
78
|
* ```
|
|
79
|
-
*
|
|
79
|
+
* @param pluginName - A unique name for the plugin (used for error reporting and debugging).
|
|
80
80
|
* @param lifecycleHooks - An object containing the hooks to be registered.
|
|
81
81
|
* @returns A standard esbuild {@link Plugin} object.
|
|
82
|
-
*
|
|
82
|
+
* @throws {TypeError} If `pluginName` is empty or not a string.
|
|
83
83
|
*/
|
|
84
84
|
export declare function createDeclarativePlugin(pluginName: string, lifecycleHooks: PluginLifecycleHooks): Plugin;
|
|
85
85
|
export {};
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
* }
|
|
25
25
|
* });
|
|
26
26
|
* ```
|
|
27
|
-
*
|
|
27
|
+
* @param pluginName - A unique name for the plugin (used for error reporting and debugging).
|
|
28
28
|
* @param lifecycleHooks - An object containing the hooks to be registered.
|
|
29
29
|
* @returns A standard esbuild {@link Plugin} object.
|
|
30
|
-
*
|
|
30
|
+
* @throws {TypeError} If `pluginName` is empty or not a string.
|
|
31
31
|
*/
|
|
32
32
|
export function createDeclarativePlugin(pluginName, lifecycleHooks) {
|
|
33
33
|
if (typeof pluginName !== 'string' || pluginName.trim().length === 0) {
|
|
@@ -37,21 +37,19 @@ export function createDeclarativePlugin(pluginName, lifecycleHooks) {
|
|
|
37
37
|
name: pluginName,
|
|
38
38
|
setup(build) {
|
|
39
39
|
if (lifecycleHooks.onStart) {
|
|
40
|
-
build.onStart(lifecycleHooks.onStart
|
|
40
|
+
build.onStart(lifecycleHooks.onStart);
|
|
41
41
|
}
|
|
42
42
|
if (lifecycleHooks.onEnd) {
|
|
43
|
-
build.onEnd(lifecycleHooks.onEnd
|
|
43
|
+
build.onEnd(lifecycleHooks.onEnd);
|
|
44
44
|
}
|
|
45
45
|
if (lifecycleHooks.onDispose) {
|
|
46
|
-
build.onDispose(lifecycleHooks.onDispose
|
|
46
|
+
build.onDispose(lifecycleHooks.onDispose);
|
|
47
47
|
}
|
|
48
48
|
if (lifecycleHooks.onLoad) {
|
|
49
|
-
|
|
50
|
-
build.onLoad(options, callback);
|
|
49
|
+
build.onLoad(lifecycleHooks.onLoad.options, lifecycleHooks.onLoad.callback);
|
|
51
50
|
}
|
|
52
51
|
if (lifecycleHooks.onResolve) {
|
|
53
|
-
|
|
54
|
-
build.onResolve(options, callback);
|
|
52
|
+
build.onResolve(lifecycleHooks.onResolve.options, lifecycleHooks.onResolve.callback);
|
|
55
53
|
}
|
|
56
54
|
},
|
|
57
55
|
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/types/config.d.ts
CHANGED
|
@@ -61,8 +61,6 @@ export interface ESBuildServerConfig {
|
|
|
61
61
|
loader: LoaderFiles;
|
|
62
62
|
/** Prevents node_modules from being bundled into the server file. */
|
|
63
63
|
packages: 'external';
|
|
64
|
-
/** Specific package names to explicitly exclude from the bundle. */
|
|
65
|
-
external: string[];
|
|
66
64
|
/** Disabled for server to leverage native Node module resolution. */
|
|
67
65
|
bundle: false;
|
|
68
66
|
}
|
|
@@ -118,3 +116,7 @@ export type ESBuildConfig = ESBuildClientDevConfig | ESBuildClientProdConfig | E
|
|
|
118
116
|
* Type alias for a map of file extensions to esbuild Loaders.
|
|
119
117
|
*/
|
|
120
118
|
export type Loaders = Record<string, Loader>;
|
|
119
|
+
/**
|
|
120
|
+
* Build Enviroment
|
|
121
|
+
*/
|
|
122
|
+
export type BuildEnv = 'dev' | 'prod';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type Metafile, type OutputFile, type Plugin, type PluginBuild, type BuildResult, type Loader, } from 'esbuild';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {} from 'esbuild';
|