sonda 0.7.1 → 0.8.0
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 +79 -0
- package/README.md +0 -4
- package/bin/sonda-angular.js +2 -2
- package/dist/entrypoints/angular.d.ts +12 -5
- package/dist/entrypoints/{angular.mjs → angular.js} +15 -17
- package/dist/entrypoints/astro.d.ts +7 -3
- package/dist/entrypoints/astro.js +26 -0
- package/dist/entrypoints/esbuild.d.ts +2 -4
- package/dist/entrypoints/esbuild.js +7 -0
- package/dist/entrypoints/next.d.ts +7 -3
- package/dist/entrypoints/next.js +23 -0
- package/dist/entrypoints/nuxt.d.ts +7 -3
- package/dist/entrypoints/nuxt.js +23 -0
- package/dist/entrypoints/rolldown.d.ts +7 -0
- package/dist/entrypoints/rolldown.js +14 -0
- package/dist/entrypoints/rollup.d.ts +2 -3
- package/dist/entrypoints/rollup.js +7 -0
- package/dist/entrypoints/rspack.d.ts +8 -0
- package/dist/entrypoints/rspack.js +12 -0
- package/dist/entrypoints/sveltekit.d.ts +7 -3
- package/dist/entrypoints/sveltekit.js +23 -0
- package/dist/entrypoints/vite.d.ts +2 -0
- package/dist/entrypoints/vite.js +7 -0
- package/dist/entrypoints/webpack.d.ts +2 -7
- package/dist/entrypoints/webpack.js +7 -0
- package/dist/index.d.ts +433 -4
- package/dist/index.html +15 -9
- package/dist/index.js +835 -0
- package/package.json +17 -63
- package/dist/entrypoints/angular.cjs +0 -55
- package/dist/entrypoints/angular.cjs.map +0 -1
- package/dist/entrypoints/angular.mjs.map +0 -1
- package/dist/entrypoints/astro.cjs +0 -26
- package/dist/entrypoints/astro.cjs.map +0 -1
- package/dist/entrypoints/astro.mjs +0 -25
- package/dist/entrypoints/astro.mjs.map +0 -1
- package/dist/entrypoints/esbuild.cjs +0 -11
- package/dist/entrypoints/esbuild.mjs +0 -4
- package/dist/entrypoints/next.cjs +0 -26
- package/dist/entrypoints/next.cjs.map +0 -1
- package/dist/entrypoints/next.mjs +0 -25
- package/dist/entrypoints/next.mjs.map +0 -1
- package/dist/entrypoints/nuxt.cjs +0 -26
- package/dist/entrypoints/nuxt.cjs.map +0 -1
- package/dist/entrypoints/nuxt.mjs +0 -25
- package/dist/entrypoints/nuxt.mjs.map +0 -1
- package/dist/entrypoints/parcel.cjs +0 -59
- package/dist/entrypoints/parcel.cjs.map +0 -1
- package/dist/entrypoints/parcel.d.ts +0 -6
- package/dist/entrypoints/parcel.mjs +0 -58
- package/dist/entrypoints/parcel.mjs.map +0 -1
- package/dist/entrypoints/rollup.cjs +0 -4
- package/dist/entrypoints/rollup.mjs +0 -4
- package/dist/entrypoints/sveltekit.cjs +0 -25
- package/dist/entrypoints/sveltekit.cjs.map +0 -1
- package/dist/entrypoints/sveltekit.mjs +0 -24
- package/dist/entrypoints/sveltekit.mjs.map +0 -1
- package/dist/entrypoints/webpack.cjs +0 -4
- package/dist/entrypoints/webpack.mjs +0 -4
- package/dist/esbuild.cjs +0 -51
- package/dist/esbuild.cjs.map +0 -1
- package/dist/esbuild.mjs +0 -39
- package/dist/esbuild.mjs.map +0 -1
- package/dist/index.cjs +0 -8
- package/dist/index.mjs +0 -3
- package/dist/report/formats.d.ts +0 -3
- package/dist/report/generate.d.ts +0 -2
- package/dist/rollup.cjs +0 -40
- package/dist/rollup.cjs.map +0 -1
- package/dist/rollup.mjs +0 -34
- package/dist/rollup.mjs.map +0 -1
- package/dist/sourcemap/bytes.d.ts +0 -4
- package/dist/sourcemap/map.d.ts +0 -7
- package/dist/src.cjs +0 -398
- package/dist/src.cjs.map +0 -1
- package/dist/src.mjs +0 -333
- package/dist/src.mjs.map +0 -1
- package/dist/types.d.ts +0 -114
- package/dist/utils.d.ts +0 -6
- package/dist/webpack.cjs +0 -55
- package/dist/webpack.cjs.map +0 -1
- package/dist/webpack.mjs +0 -49
- package/dist/webpack.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,82 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
This is the biggest release of Sonda to date, featuring a complete rewrite of both the backend and frontend. The goals of this rewrite were to:
|
|
6
|
+
|
|
7
|
+
- Make it easier to inspect large projects with multiple outputs
|
|
8
|
+
- Display much more information about assets, inputs, external dependencies, and import relationships
|
|
9
|
+
- Significantly reduce the size of the HTML report files
|
|
10
|
+
- Prepare the codebase for future improvements and features
|
|
11
|
+
|
|
12
|
+
### Highlights
|
|
13
|
+
|
|
14
|
+
- **New HTML report design** – The report has been redesigned to improve navigation and clarity, especially for large projects with multiple outputs. See the [demo page](https://sonda.dev/demo) for an example.
|
|
15
|
+
- **New JSON report format** – The JSON format has been overhauled to better differentiate resource types and expose relationships between them. For details, refer to the [JSON report](https://sonda.dev/features/json-report.html) documentation.
|
|
16
|
+
- **ESM-only** – Sonda is now ESM-only and requires Node.js 20.19 or 22.12+. This change helps reduce the distribution size.
|
|
17
|
+
- **New output directory** – Reports are now saved to the `.sonda` directory and are prefixed with a unique number to avoid overwriting existing reports.
|
|
18
|
+
|
|
19
|
+
### Migration
|
|
20
|
+
|
|
21
|
+
If you're upgrading from version 0.7, you'll need to update your import paths and configuration.
|
|
22
|
+
|
|
23
|
+
#### Import Paths
|
|
24
|
+
|
|
25
|
+
Each integration now has its own import path. It's recommended to use the path specific to your framework or bundler, as these may include optimizations that improve performance and accuracy.
|
|
26
|
+
|
|
27
|
+
For example, if you're using Vite or Rolldown, use their dedicated import paths instead of the generic Rollup integration path.
|
|
28
|
+
|
|
29
|
+
Available import paths:
|
|
30
|
+
|
|
31
|
+
- `sonda/angular`
|
|
32
|
+
- `sonda/astro`
|
|
33
|
+
- `sonda/esbuild`
|
|
34
|
+
- `sonda/next`
|
|
35
|
+
- `sonda/nuxt`
|
|
36
|
+
- `sonda/rolldown`
|
|
37
|
+
- `sonda/rollup`
|
|
38
|
+
- `sonda/rspack`
|
|
39
|
+
- `sonda/sveltekit`
|
|
40
|
+
- `sonda/vite`
|
|
41
|
+
- `sonda/webpack`
|
|
42
|
+
|
|
43
|
+
#### Configuration
|
|
44
|
+
|
|
45
|
+
- The `filename` option has been removed and replaced with `outputDir`, which defaults to `.sonda`. All reports are saved to this directory, and filenames are prefixed with a unique number to prevent overwriting.
|
|
46
|
+
- The `detailed` option has been renamed to `deep`.
|
|
47
|
+
|
|
48
|
+
#### JSON Report
|
|
49
|
+
|
|
50
|
+
The JSON report format has been completely redesigned. For complete details, refer to the updated [JSON report](https://sonda.dev/features/json-report.html) documentation.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### Major Changes
|
|
55
|
+
|
|
56
|
+
- 0c0113f: BREAKING CHANGE: Drop support for Node 18 and require at least Node 20.19 or 22.12
|
|
57
|
+
- 0c0113f: BREAKING CHANGE: Distribute only the ESM builds
|
|
58
|
+
- 0c0113f: BREAKING CHANGE: Rename the `detailed` configuration option to `deep`.
|
|
59
|
+
- 0c0113f: BREAKING CHANGE: Reports are now saved to the `.sonda` folder by default. The `filename` configuration option has been replaced with the `outputDir` option. Each new report will end with incremented numbers to avoid overwriting previous reports. For example:
|
|
60
|
+
|
|
61
|
+
- `.sonda/sonda_1.html`
|
|
62
|
+
- `.sonda/sonda_2.html`
|
|
63
|
+
- `.sonda/sonda_3.html`
|
|
64
|
+
|
|
65
|
+
- 0c0113f: BREAKING CHANGE: Change format of the JSON report
|
|
66
|
+
- 0c0113f: BREAKING CHANGE: Redesign the HTML report
|
|
67
|
+
|
|
68
|
+
### Minor Changes
|
|
69
|
+
|
|
70
|
+
- 0c0113f: Add new `sonda/rolldown`, `sonda/rspack` and `sonda/vite` entrypoints
|
|
71
|
+
- 0c0113f: GZIP data in HTML report to reduce its size
|
|
72
|
+
|
|
73
|
+
### Patch Changes
|
|
74
|
+
|
|
75
|
+
- 0c0113f: Run Vite integration only in production build
|
|
76
|
+
- 0c0113f: Fix detection of input files in Next.js integration
|
|
77
|
+
- 0c0113f: Update all dependencies
|
|
78
|
+
- 0c0113f: Don't change paths in sourcemaps generated by webpack and add handling webpack specific path formats
|
|
79
|
+
|
|
3
80
|
## 0.7.1
|
|
4
81
|
|
|
5
82
|
### Patch Changes
|
|
@@ -34,6 +111,8 @@ Sonda now has integrations for the following frameworks:
|
|
|
34
111
|
|
|
35
112
|
You can now control whether the Sonda plugin is enabled or not using the `enabled` option.
|
|
36
113
|
|
|
114
|
+
---
|
|
115
|
+
|
|
37
116
|
### Minor Changes
|
|
38
117
|
|
|
39
118
|
- 215b289: Create an individual export path for each integration
|
package/README.md
CHANGED
|
@@ -25,7 +25,3 @@ For installation and usage instructions, visit [https://sonda.dev](https://sonda
|
|
|
25
25
|
## Demo
|
|
26
26
|
|
|
27
27
|
You can try Sonda at [https://sonda.dev/demo](https://sonda.dev/demo).
|
|
28
|
-
|
|
29
|
-
## Screenshot
|
|
30
|
-
|
|
31
|
-

|
package/bin/sonda-angular.js
CHANGED
|
@@ -8,9 +8,9 @@ const { values } = parseArgs( {
|
|
|
8
8
|
config: { type: 'string' },
|
|
9
9
|
projects: { type: 'string', multiple: true },
|
|
10
10
|
format: { type: 'string' },
|
|
11
|
-
|
|
11
|
+
outputDir: { type: 'string' },
|
|
12
12
|
'no-open': { type: 'boolean' },
|
|
13
|
-
|
|
13
|
+
deep: { type: 'boolean' },
|
|
14
14
|
sources: { type: 'boolean' },
|
|
15
15
|
gzip: { type: 'boolean' },
|
|
16
16
|
brotli: { type: 'boolean' }
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { UserOptions } from "sonda";
|
|
2
|
+
|
|
3
|
+
//#region src/entrypoints/angular.d.ts
|
|
2
4
|
interface AngularUserOptions extends UserOptions {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
config: string;
|
|
6
|
+
projects: string[];
|
|
5
7
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
declare function SondaAngular({
|
|
9
|
+
config,
|
|
10
|
+
projects,
|
|
11
|
+
...userOptions
|
|
12
|
+
}: AngularUserOptions): Promise<void>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { SondaAngular as default };
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import "../src.mjs";
|
|
2
|
-
import { processEsbuildMetaFile } from "../esbuild.mjs";
|
|
3
1
|
import { basename, relative, resolve } from "path";
|
|
4
2
|
import { readFileSync, readdirSync } from "fs";
|
|
3
|
+
import { Config, processEsbuildMetafile } from "sonda";
|
|
5
4
|
|
|
6
5
|
//#region src/entrypoints/angular.ts
|
|
7
|
-
function SondaAngular(
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (!opts.filename.includes("[project]")) throw new Error("SondaAngular: The \"filename\" option must include the \"[project]\" token.");
|
|
6
|
+
async function SondaAngular({ config = "angular.json", projects = [],...userOptions }) {
|
|
7
|
+
const options = new Config(userOptions, {
|
|
8
|
+
integration: "angular",
|
|
9
|
+
filename: "sonda_[project]"
|
|
10
|
+
});
|
|
13
11
|
const angularConfig = loadJson(config);
|
|
14
12
|
const projectsToGenerate = projects.length ? projects : Object.keys(angularConfig.projects);
|
|
15
13
|
for (const project of projectsToGenerate) {
|
|
16
14
|
const { outputPath } = angularConfig.projects[project].architect.build.options;
|
|
17
15
|
const paths = typeof outputPath === "object" ? outputPath : { base: outputPath };
|
|
18
|
-
paths.base = resolve(cwd, paths.base);
|
|
16
|
+
paths.base = resolve(process.cwd(), paths.base);
|
|
19
17
|
paths.browser = resolve(paths.base, paths.browser || "browser");
|
|
20
18
|
paths.server = resolve(paths.base, paths.server || "server");
|
|
21
|
-
const metafile = updateMetafile(loadJson(resolve(paths.base, "stats.json")), paths);
|
|
22
|
-
const sondaOptions =
|
|
19
|
+
const metafile = updateMetafile(loadJson(resolve(paths.base, "stats.json")), paths.base);
|
|
20
|
+
const sondaOptions = options.clone();
|
|
23
21
|
sondaOptions.filename = sondaOptions.filename.replace("[project]", project);
|
|
24
|
-
|
|
22
|
+
sondaOptions.sourcesPathNormalizer = (path) => resolve(process.cwd(), path);
|
|
23
|
+
await processEsbuildMetafile(metafile, sondaOptions);
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
function loadJson(path) {
|
|
@@ -33,15 +32,15 @@ function loadJson(path) {
|
|
|
33
32
|
* file system it's "dist/project/browser/en/main-xxx.js". This function updates the output paths
|
|
34
33
|
* to include the relative path from the current working directory.
|
|
35
34
|
*/
|
|
36
|
-
function updateMetafile(metafile,
|
|
35
|
+
function updateMetafile(metafile, basePath) {
|
|
37
36
|
const cwd = process.cwd();
|
|
38
37
|
const outputs = Object.assign({}, metafile.outputs);
|
|
39
38
|
metafile.outputs = {};
|
|
40
|
-
for (const path of readdirSync(
|
|
39
|
+
for (const path of readdirSync(basePath, {
|
|
41
40
|
encoding: "utf8",
|
|
42
41
|
recursive: true
|
|
43
42
|
})) {
|
|
44
|
-
const absolutePath = resolve(
|
|
43
|
+
const absolutePath = resolve(basePath, path);
|
|
45
44
|
const filename = basename(absolutePath);
|
|
46
45
|
const originalOutput = outputs[filename];
|
|
47
46
|
if (originalOutput) metafile.outputs[relative(cwd, absolutePath)] = originalOutput;
|
|
@@ -50,5 +49,4 @@ function updateMetafile(metafile, paths) {
|
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
//#endregion
|
|
53
|
-
export { SondaAngular as default };
|
|
54
|
-
//# sourceMappingURL=angular.mjs.map
|
|
52
|
+
export { SondaAngular as default };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { UserOptions } from "sonda";
|
|
2
|
+
import { AstroIntegration } from "astro";
|
|
3
|
+
|
|
4
|
+
//#region src/entrypoints/astro.d.ts
|
|
5
|
+
declare function SondaAstroPlugin(userOptions?: UserOptions): AstroIntegration;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { SondaAstroPlugin as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Config, SondaVitePlugin } from "sonda";
|
|
2
|
+
|
|
3
|
+
//#region src/entrypoints/astro.ts
|
|
4
|
+
function SondaAstroPlugin(userOptions = {}) {
|
|
5
|
+
const options = new Config(userOptions, {
|
|
6
|
+
integration: "astro",
|
|
7
|
+
filename: "sonda_[env]"
|
|
8
|
+
});
|
|
9
|
+
if (!options.enabled) return {
|
|
10
|
+
name: "sonda-astro",
|
|
11
|
+
hooks: {}
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
name: "sonda-astro",
|
|
15
|
+
hooks: { "astro:build:setup"({ vite, target }) {
|
|
16
|
+
if (target === "server" && !options.server) return;
|
|
17
|
+
const sondaOptions = options.clone();
|
|
18
|
+
sondaOptions.filename = sondaOptions.filename.replace("[env]", target);
|
|
19
|
+
vite.plugins ??= [];
|
|
20
|
+
vite.plugins.push(SondaVitePlugin(sondaOptions));
|
|
21
|
+
} }
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { SondaAstroPlugin as default };
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export default function SondaEsbuildPlugin(options?: Partial<UserOptions>): Plugin;
|
|
4
|
-
export declare function processEsbuildMetaFile(metafile: Metafile, options: Partial<UserOptions>): void;
|
|
1
|
+
import { SondaEsbuildPlugin } from "sonda";
|
|
2
|
+
export { SondaEsbuildPlugin as default };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { UserOptions } from "sonda";
|
|
2
|
+
import { NextConfig } from "next";
|
|
3
|
+
|
|
4
|
+
//#region src/entrypoints/next.d.ts
|
|
5
|
+
declare function SondaNextPlugin(userOptions?: UserOptions): (nextConfig?: NextConfig) => NextConfig;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { SondaNextPlugin as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Config, SondaWebpackPlugin } from "sonda";
|
|
2
|
+
|
|
3
|
+
//#region src/entrypoints/next.ts
|
|
4
|
+
function SondaNextPlugin(userOptions = {}) {
|
|
5
|
+
return function Sonda(nextConfig = {}) {
|
|
6
|
+
const options = new Config(userOptions, {
|
|
7
|
+
integration: "next",
|
|
8
|
+
filename: "sonda_[env]"
|
|
9
|
+
});
|
|
10
|
+
if (!options.enabled) return nextConfig;
|
|
11
|
+
return Object.assign({}, nextConfig, { webpack(config, { nextRuntime, isServer }) {
|
|
12
|
+
const env = nextRuntime || "client";
|
|
13
|
+
if (env === "edge" || isServer && !options.server) return config;
|
|
14
|
+
const sondaOptions = options.clone();
|
|
15
|
+
sondaOptions.filename = sondaOptions.filename.replace("[env]", env);
|
|
16
|
+
config.plugins.push(new SondaWebpackPlugin(sondaOptions));
|
|
17
|
+
return config;
|
|
18
|
+
} });
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { SondaNextPlugin as default };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { UserOptions } from "sonda";
|
|
2
|
+
import { NuxtModule } from "@nuxt/schema";
|
|
3
|
+
|
|
4
|
+
//#region src/entrypoints/nuxt.d.ts
|
|
5
|
+
declare function SondaNuxtPlugin(userOptions?: UserOptions): NuxtModule;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { SondaNuxtPlugin as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Config, SondaVitePlugin } from "sonda";
|
|
2
|
+
|
|
3
|
+
//#region src/entrypoints/nuxt.ts
|
|
4
|
+
function SondaNuxtPlugin(userOptions = {}) {
|
|
5
|
+
return function SondaNuxtPlugin$1(_, nuxt) {
|
|
6
|
+
const options = new Config(userOptions, {
|
|
7
|
+
integration: "nuxt",
|
|
8
|
+
filename: "sonda_[env]"
|
|
9
|
+
});
|
|
10
|
+
if (!options.enabled) return;
|
|
11
|
+
nuxt.hook("vite:extendConfig", (config, { isClient, isServer }) => {
|
|
12
|
+
const env = isClient ? "client" : "nitro";
|
|
13
|
+
if (isServer && !options.server) return;
|
|
14
|
+
const sondaOptions = options.clone();
|
|
15
|
+
sondaOptions.filename = sondaOptions.filename.replace("[env]", env);
|
|
16
|
+
config.plugins ??= [];
|
|
17
|
+
config.plugins.push(SondaVitePlugin(sondaOptions));
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { SondaNuxtPlugin as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Config, SondaRollupPlugin } from "sonda";
|
|
2
|
+
|
|
3
|
+
//#region src/entrypoints/rolldown.ts
|
|
4
|
+
function RolldownPlugin(userOptions = {}) {
|
|
5
|
+
const options = new Config(userOptions, { integration: "rolldown" });
|
|
6
|
+
if (!options.enabled) return { name: "sonda-rolldown" };
|
|
7
|
+
return {
|
|
8
|
+
...SondaRollupPlugin(options),
|
|
9
|
+
name: "sonda-rolldown"
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { RolldownPlugin as default };
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export default function SondaRollupPlugin(options?: Partial<UserOptions>): Plugin;
|
|
1
|
+
import { SondaRollupPlugin } from "sonda";
|
|
2
|
+
export { SondaRollupPlugin as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Config, SondaWebpackPlugin } from "sonda";
|
|
2
|
+
|
|
3
|
+
//#region src/entrypoints/rspack.ts
|
|
4
|
+
var SondaRspackPlugin = class extends SondaWebpackPlugin {
|
|
5
|
+
constructor(userOptions = {}) {
|
|
6
|
+
super(userOptions);
|
|
7
|
+
this.options = new Config(userOptions, { integration: "rspack" });
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { SondaRspackPlugin as default };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { UserOptions } from "sonda";
|
|
2
|
+
import { PluginOption } from "vite";
|
|
3
|
+
|
|
4
|
+
//#region src/entrypoints/sveltekit.d.ts
|
|
5
|
+
declare function SondaSvelteKitPlugin(userOptions?: UserOptions): PluginOption;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { SondaSvelteKitPlugin as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Config, SondaVitePlugin } from "sonda";
|
|
2
|
+
|
|
3
|
+
//#region src/entrypoints/sveltekit.ts
|
|
4
|
+
function SondaSvelteKitPlugin(userOptions = {}) {
|
|
5
|
+
const options = new Config(userOptions, {
|
|
6
|
+
integration: "sveltekit",
|
|
7
|
+
filename: "sonda_[env]"
|
|
8
|
+
});
|
|
9
|
+
if (!options.enabled) return { name: "sonda-sveltekit" };
|
|
10
|
+
return {
|
|
11
|
+
...SondaVitePlugin(options),
|
|
12
|
+
name: "sonda-sveltekit",
|
|
13
|
+
configResolved(config) {
|
|
14
|
+
const env = config.build.ssr ? "server" : "client";
|
|
15
|
+
const generateForServer = userOptions.server ?? false;
|
|
16
|
+
if (env === "server" && !generateForServer) userOptions.enabled = false;
|
|
17
|
+
options.filename = options.filename.replace("[env]", env);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { SondaSvelteKitPlugin as default };
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export default class SondaWebpackPlugin {
|
|
4
|
-
options: Partial<UserOptions>;
|
|
5
|
-
constructor(options?: Partial<UserOptions>);
|
|
6
|
-
apply(compiler: Compiler): void;
|
|
7
|
-
}
|
|
1
|
+
import { SondaWebpackPlugin } from "sonda";
|
|
2
|
+
export { SondaWebpackPlugin as default };
|