@swift-rust/bundle-analyzer 0.2.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/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # @swift-rust/bundle-analyzer
2
+
3
+ Identifies what's actually inside your production bundle. Wraps the bundler output and emits a treemap you can open in a browser.
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import { withBundleAnalyzer } from "@swift-rust/bundle-analyzer";
9
+
10
+ export default withBundleAnalyzer({
11
+ // swift-rust config
12
+ }, {
13
+ enabled: process.env.ANALYZE === "true",
14
+ });
15
+ ```
16
+
17
+ Then run:
18
+
19
+ ```bash
20
+ ANALYZE=true bun swift-rust build
21
+ open .swift-rust/analyze/client.html
22
+ ```
@@ -0,0 +1,16 @@
1
+ export interface AnalyzerOptions {
2
+ enabled?: boolean;
3
+ outDir?: string;
4
+ reportFilename?: string;
5
+ showOutput?: boolean;
6
+ defaultSizes?: "stat" | "parsed" | "gzip";
7
+ }
8
+ export declare const withBundleAnalyzer: (config?: {
9
+ bundleAnalyzer?: AnalyzerOptions;
10
+ }, options?: AnalyzerOptions) => {
11
+ bundleAnalyzer: AnalyzerOptions;
12
+ };
13
+ export declare const isEnabled: (config: {
14
+ bundleAnalyzer?: AnalyzerOptions;
15
+ }) => boolean;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;CAC3C;AAED,eAAO,MAAM,kBAAkB,GAC7B,SAAQ;IAAE,cAAc,CAAC,EAAE,eAAe,CAAA;CAAO,EACjD,UAAS,eAAoB,KAC5B;IAAE,cAAc,EAAE,eAAe,CAAA;CAYnC,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,QAAQ;IAAE,cAAc,CAAC,EAAE,eAAe,CAAA;CAAE,KAAG,OAChC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ export const withBundleAnalyzer = (config = {}, options = {}) => {
2
+ return {
3
+ bundleAnalyzer: {
4
+ enabled: true,
5
+ defaultSizes: "gzip",
6
+ outDir: ".swift-rust/analyze",
7
+ reportFilename: "client.html",
8
+ showOutput: true,
9
+ ...options,
10
+ ...config.bundleAnalyzer,
11
+ },
12
+ };
13
+ };
14
+ export const isEnabled = (config) => Boolean(config.bundleAnalyzer?.enabled);
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,SAA+C,EAAE,EACjD,UAA2B,EAAE,EACQ,EAAE;IACvC,OAAO;QACL,cAAc,EAAE;YACd,OAAO,EAAE,IAAI;YACb,YAAY,EAAE,MAAM;YACpB,MAAM,EAAE,qBAAqB;YAC7B,cAAc,EAAE,aAAa;YAC7B,UAAU,EAAE,IAAI;YAChB,GAAG,OAAO;YACV,GAAG,MAAM,CAAC,cAAc;SACzB;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAA4C,EAAW,EAAE,CACjF,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=smoke.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smoke.test.d.ts","sourceRoot":"","sources":["../src/smoke.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { expect, test } from "bun:test";
2
+ import * as mod from "./index";
3
+ test("package exports a default or named module", () => {
4
+ expect(mod).toBeDefined();
5
+ });
6
+ //# sourceMappingURL=smoke.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smoke.test.js","sourceRoot":"","sources":["../src/smoke.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAE/B,IAAI,CAAC,2CAA2C,EAAE,GAAG,EAAE;IACrD,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@swift-rust/bundle-analyzer",
3
+ "version": "0.2.0",
4
+ "description": "Visualize the size of swift-rust bundles.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc -p tsconfig.json",
20
+ "dev": "tsc -p tsconfig.json --watch",
21
+ "lint": "biome check --no-errors-on-unmatched $(pwd)/src",
22
+ "test": "bun test",
23
+ "typecheck": "tsc --noEmit",
24
+ "clean": "rm -rf dist .turbo"
25
+ },
26
+ "dependencies": {
27
+ "chalk": "^5.3.0",
28
+ "gzip-size": "^7.0.0",
29
+ "read": "^3.0.1"
30
+ },
31
+ "devDependencies": {
32
+ "typescript": "^6.0.0"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/swift-rust/swift-rust.git",
40
+ "directory": "packages/bundle-analyzer"
41
+ },
42
+ "bugs": {
43
+ "url": "https://github.com/swift-rust/swift-rust/issues"
44
+ },
45
+ "homepage": "https://swift-rust.dev"
46
+ }