@sdeverywhere/plugin-vite 0.2.3 → 0.2.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/dist/index.d.ts CHANGED
@@ -1,40 +1,42 @@
1
- import { InlineConfig } from 'vite';
2
- import { Plugin } from '@sdeverywhere/build';
3
-
1
+ import { InlineConfig } from "vite";
2
+ import { Plugin } from "@sdeverywhere/build";
3
+ //#region src/options.d.ts
4
4
  interface VitePluginOptions {
5
- /** The name to include in log messages. */
6
- name: string;
7
- /** The Vite config to use. */
8
- config: InlineConfig;
9
- /** Specifies the behavior of the plugin for different `sde` build modes. */
10
- apply?: {
11
- /**
12
- * The behavior of the plugin when sde is configured for development mode.
13
- *
14
- * If left undefined, defaults to 'post-build'.
15
- *
16
- * - `skip`: Don't run the plugin.
17
- * - `post-generate`: Run `vite build` in the `postGenerate` phase.
18
- * - `post-build`: Run `vite build` in the `postBuild` phase.
19
- * - `watch`: Run `vite build` in the `watch` callback (rebuilds the library when
20
- * changes are detected in source files); useful for libraries.
21
- * - `serve`: Run `vite dev` (sets up local server and refreshes the app
22
- * automatically when changes are detected); useful for applications.
23
- */
24
- development?: 'skip' | 'post-generate' | 'post-build' | 'watch' | 'serve';
25
- /**
26
- * The behavior of the plugin when sde is configured for production mode.
27
- *
28
- * If left undefined, defaults to 'post-build'.
29
- *
30
- * - `skip`: Don't run the plugin.
31
- * - `post-generate`: Run `vite build` in the `postGenerate` phase.
32
- * - `post-build`: Run `vite build` in the `postBuild` phase.
33
- */
34
- production?: 'skip' | 'post-generate' | 'post-build';
35
- };
5
+ /** The name to include in log messages. */
6
+ name: string;
7
+ /** The Vite config to use. */
8
+ config: InlineConfig;
9
+ /** Specifies the behavior of the plugin for different `sde` build modes. */
10
+ apply?: {
11
+ /**
12
+ * The behavior of the plugin when sde is configured for development mode.
13
+ *
14
+ * If left undefined, defaults to 'post-build'.
15
+ *
16
+ * - `skip`: Don't run the plugin.
17
+ * - `post-generate`: Run `vite build` in the `postGenerate` phase.
18
+ * - `post-build`: Run `vite build` in the `postBuild` phase.
19
+ * - `watch`: Run `vite build` in the `watch` callback (rebuilds the library when
20
+ * changes are detected in source files); useful for libraries.
21
+ * - `serve`: Run `vite dev` (sets up local server and refreshes the app
22
+ * automatically when changes are detected); useful for applications.
23
+ */
24
+ development?: 'skip' | 'post-generate' | 'post-build' | 'watch' | 'serve';
25
+ /**
26
+ * The behavior of the plugin when sde is configured for production mode.
27
+ *
28
+ * If left undefined, defaults to 'post-build'.
29
+ *
30
+ * - `skip`: Don't run the plugin.
31
+ * - `post-generate`: Run `vite build` in the `postGenerate` phase.
32
+ * - `post-build`: Run `vite build` in the `postBuild` phase.
33
+ */
34
+ production?: 'skip' | 'post-generate' | 'post-build';
35
+ };
36
36
  }
37
-
38
- declare function vitePlugin(options: VitePluginOptions): Plugin;
39
-
40
- export { type VitePluginOptions, vitePlugin };
37
+ //#endregion
38
+ //#region src/plugin.d.ts
39
+ export declare function vitePlugin(options: VitePluginOptions): Plugin;
40
+ //#endregion
41
+ export type { VitePluginOptions };
42
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/options.d.ts","../src/plugin.d.ts"],"mappings":";;;UACiB;;EAEb;;EAEA,QAAQ;;EAER;;;;;;;;;;;;;;IAcI;;;;;;;;;;IAUA;;;;;wBC7BgB,WAAW,SAAS,oBAAoB"}
package/dist/index.js CHANGED
@@ -1,46 +1,39 @@
1
- // src/plugin.ts
2
1
  import { build, createServer } from "vite";
2
+ //#region src/plugin.ts
3
3
  function vitePlugin(options) {
4
- return new VitePlugin(options);
4
+ return new VitePlugin(options);
5
5
  }
6
6
  var VitePlugin = class {
7
- constructor(options) {
8
- this.options = options;
9
- }
10
- async postGenerate(context) {
11
- return this.buildIfNeeded(context, "post-generate");
12
- }
13
- async postBuild(context) {
14
- return this.buildIfNeeded(context, "post-build");
15
- }
16
- async buildIfNeeded(context, caller) {
17
- const applyDev = this.options.apply?.development || "post-build";
18
- const applyProd = this.options.apply?.production || "post-build";
19
- const shouldBuild = context.config.mode === "development" && applyDev === caller || context.config.mode === "production" && applyProd === caller;
20
- if (shouldBuild) {
21
- context.log("info", `Building ${this.options.name}`);
22
- await build(this.options.config);
23
- }
24
- return true;
25
- }
26
- async watch() {
27
- if (this.options.apply?.development === "serve") {
28
- const server = await createServer(this.options.config);
29
- await server.listen();
30
- } else if (this.options.apply?.development === "watch") {
31
- const config = {
32
- build: {
33
- // Enable watch mode
34
- // TODO: Only do this if not already set up in the given config?
35
- watch: {}
36
- },
37
- ...this.options.config
38
- };
39
- await build(config);
40
- }
41
- }
42
- };
43
- export {
44
- vitePlugin
7
+ constructor(options) {
8
+ this.options = options;
9
+ }
10
+ async postGenerate(context) {
11
+ return this.buildIfNeeded(context, "post-generate");
12
+ }
13
+ async postBuild(context) {
14
+ return this.buildIfNeeded(context, "post-build");
15
+ }
16
+ async buildIfNeeded(context, caller) {
17
+ const applyDev = this.options.apply?.development || "post-build";
18
+ const applyProd = this.options.apply?.production || "post-build";
19
+ if (context.config.mode === "development" && applyDev === caller || context.config.mode === "production" && applyProd === caller) {
20
+ context.log("info", `Building ${this.options.name}`);
21
+ await build(this.options.config);
22
+ }
23
+ return true;
24
+ }
25
+ async watch() {
26
+ if (this.options.apply?.development === "serve") await (await createServer(this.options.config)).listen();
27
+ else if (this.options.apply?.development === "watch") {
28
+ const config = {
29
+ build: { watch: {} },
30
+ ...this.options.config
31
+ };
32
+ await build(config);
33
+ }
34
+ }
45
35
  };
36
+ //#endregion
37
+ export { vitePlugin };
38
+
46
39
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["// Copyright (c) 2022 Climate Interactive / New Venture Fund\n\nimport type { InlineConfig, ViteDevServer } from 'vite'\nimport { build, createServer } from 'vite'\n\nimport type { BuildContext, Plugin } from '@sdeverywhere/build'\n\nimport type { VitePluginOptions } from './options'\n\nexport function vitePlugin(options: VitePluginOptions): Plugin {\n return new VitePlugin(options)\n}\n\nclass VitePlugin implements Plugin {\n constructor(private readonly options: VitePluginOptions) {}\n\n async postGenerate(context: BuildContext): Promise<boolean> {\n // Only build if the plugin is configured to run for 'post-generate'\n return this.buildIfNeeded(context, 'post-generate')\n }\n\n async postBuild(context: BuildContext): Promise<boolean> {\n // Only build if the plugin is configured to run for 'post-build'\n return this.buildIfNeeded(context, 'post-build')\n }\n\n private async buildIfNeeded(context: BuildContext, caller: 'post-generate' | 'post-build'): Promise<boolean> {\n // The apply values default to 'post-build' when left undefined\n const applyDev = this.options.apply?.development || 'post-build'\n const applyProd = this.options.apply?.production || 'post-build'\n\n // Run \"vite build\" only if configured for this mode\n const shouldBuild =\n (context.config.mode === 'development' && applyDev === caller) ||\n (context.config.mode === 'production' && applyProd === caller)\n if (shouldBuild) {\n context.log('info', `Building ${this.options.name}`)\n await build(this.options.config)\n // context.log('info', 'Done!')\n }\n return true\n }\n\n async watch(): Promise<void> {\n if (this.options.apply?.development === 'serve') {\n // Run \"vite dev\", which starts the app in a local server and\n // refreshes when source files are changed\n const server: ViteDevServer = await createServer(this.options.config)\n await server.listen()\n } else if (this.options.apply?.development === 'watch') {\n // Run \"vite build\" in watch mode so that it rebuilds when source\n // files are changed\n const config: InlineConfig = {\n build: {\n // Enable watch mode\n // TODO: Only do this if not already set up in the given config?\n watch: {}\n },\n ...this.options.config\n }\n await build(config)\n }\n }\n}\n"],"mappings":";AAGA,SAAS,OAAO,oBAAoB;AAM7B,SAAS,WAAW,SAAoC;AAC7D,SAAO,IAAI,WAAW,OAAO;AAC/B;AAEA,IAAM,aAAN,MAAmC;AAAA,EACjC,YAA6B,SAA4B;AAA5B;AAAA,EAA6B;AAAA,EAE1D,MAAM,aAAa,SAAyC;AAE1D,WAAO,KAAK,cAAc,SAAS,eAAe;AAAA,EACpD;AAAA,EAEA,MAAM,UAAU,SAAyC;AAEvD,WAAO,KAAK,cAAc,SAAS,YAAY;AAAA,EACjD;AAAA,EAEA,MAAc,cAAc,SAAuB,QAA0D;AAE3G,UAAM,WAAW,KAAK,QAAQ,OAAO,eAAe;AACpD,UAAM,YAAY,KAAK,QAAQ,OAAO,cAAc;AAGpD,UAAM,cACH,QAAQ,OAAO,SAAS,iBAAiB,aAAa,UACtD,QAAQ,OAAO,SAAS,gBAAgB,cAAc;AACzD,QAAI,aAAa;AACf,cAAQ,IAAI,QAAQ,YAAY,KAAK,QAAQ,IAAI,EAAE;AACnD,YAAM,MAAM,KAAK,QAAQ,MAAM;AAAA,IAEjC;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,QAAuB;AAC3B,QAAI,KAAK,QAAQ,OAAO,gBAAgB,SAAS;AAG/C,YAAM,SAAwB,MAAM,aAAa,KAAK,QAAQ,MAAM;AACpE,YAAM,OAAO,OAAO;AAAA,IACtB,WAAW,KAAK,QAAQ,OAAO,gBAAgB,SAAS;AAGtD,YAAM,SAAuB;AAAA,QAC3B,OAAO;AAAA;AAAA;AAAA,UAGL,OAAO,CAAC;AAAA,QACV;AAAA,QACA,GAAG,KAAK,QAAQ;AAAA,MAClB;AACA,YAAM,MAAM,MAAM;AAAA,IACpB;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["// Copyright (c) 2022 Climate Interactive / New Venture Fund\n\nimport type { InlineConfig, ViteDevServer } from 'vite'\nimport { build, createServer } from 'vite'\n\nimport type { BuildContext, Plugin } from '@sdeverywhere/build'\n\nimport type { VitePluginOptions } from './options'\n\nexport function vitePlugin(options: VitePluginOptions): Plugin {\n return new VitePlugin(options)\n}\n\nclass VitePlugin implements Plugin {\n constructor(private readonly options: VitePluginOptions) {}\n\n async postGenerate(context: BuildContext): Promise<boolean> {\n // Only build if the plugin is configured to run for 'post-generate'\n return this.buildIfNeeded(context, 'post-generate')\n }\n\n async postBuild(context: BuildContext): Promise<boolean> {\n // Only build if the plugin is configured to run for 'post-build'\n return this.buildIfNeeded(context, 'post-build')\n }\n\n private async buildIfNeeded(context: BuildContext, caller: 'post-generate' | 'post-build'): Promise<boolean> {\n // The apply values default to 'post-build' when left undefined\n const applyDev = this.options.apply?.development || 'post-build'\n const applyProd = this.options.apply?.production || 'post-build'\n\n // Run \"vite build\" only if configured for this mode\n const shouldBuild =\n (context.config.mode === 'development' && applyDev === caller) ||\n (context.config.mode === 'production' && applyProd === caller)\n if (shouldBuild) {\n context.log('info', `Building ${this.options.name}`)\n await build(this.options.config)\n // context.log('info', 'Done!')\n }\n return true\n }\n\n async watch(): Promise<void> {\n if (this.options.apply?.development === 'serve') {\n // Run \"vite dev\", which starts the app in a local server and\n // refreshes when source files are changed\n const server: ViteDevServer = await createServer(this.options.config)\n await server.listen()\n } else if (this.options.apply?.development === 'watch') {\n // Run \"vite build\" in watch mode so that it rebuilds when source\n // files are changed\n const config: InlineConfig = {\n build: {\n // Enable watch mode\n // TODO: Only do this if not already set up in the given config?\n watch: {}\n },\n ...this.options.config\n }\n await build(config)\n }\n }\n}\n"],"mappings":";;AASA,SAAgB,WAAW,SAAoC;CAC7D,OAAO,IAAI,WAAW,OAAO;AAC/B;AAEA,IAAM,aAAN,MAAmC;CACjC,YAAY,SAA6C;EAA5B,KAAA,UAAA;CAA6B;CAE1D,MAAM,aAAa,SAAyC;EAE1D,OAAO,KAAK,cAAc,SAAS,eAAe;CACpD;CAEA,MAAM,UAAU,SAAyC;EAEvD,OAAO,KAAK,cAAc,SAAS,YAAY;CACjD;CAEA,MAAc,cAAc,SAAuB,QAA0D;EAE3G,MAAM,WAAW,KAAK,QAAQ,OAAO,eAAe;EACpD,MAAM,YAAY,KAAK,QAAQ,OAAO,cAAc;EAMpD,IAFG,QAAQ,OAAO,SAAS,iBAAiB,aAAa,UACtD,QAAQ,OAAO,SAAS,gBAAgB,cAAc,QACxC;GACf,QAAQ,IAAI,QAAQ,YAAY,KAAK,QAAQ,MAAM;GACnD,MAAM,MAAM,KAAK,QAAQ,MAAM;EAEjC;EACA,OAAO;CACT;CAEA,MAAM,QAAuB;EAC3B,IAAI,KAAK,QAAQ,OAAO,gBAAgB,SAItC,OAAM,MAD8B,aAAa,KAAK,QAAQ,MAAM,EAAA,CACvD,OAAO;OACf,IAAI,KAAK,QAAQ,OAAO,gBAAgB,SAAS;GAGtD,MAAM,SAAuB;IAC3B,OAAO,EAGL,OAAO,CAAC,EACV;IACA,GAAG,KAAK,QAAQ;GAClB;GACA,MAAM,MAAM,MAAM;EACpB;CACF;AACF"}
package/package.json CHANGED
@@ -1,26 +1,24 @@
1
1
  {
2
2
  "name": "@sdeverywhere/plugin-vite",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "files": [
5
5
  "dist/**"
6
6
  ],
7
7
  "type": "module",
8
- "main": "dist/index.cjs",
9
8
  "module": "dist/index.js",
10
9
  "types": "dist/index.d.ts",
11
10
  "exports": {
12
11
  ".": {
13
12
  "types": "./dist/index.d.ts",
14
- "import": "./dist/index.js",
15
- "require": "./dist/index.cjs"
13
+ "import": "./dist/index.js"
16
14
  }
17
15
  },
18
16
  "peerDependencies": {
19
17
  "@sdeverywhere/build": "^0.3.10",
20
- "vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
18
+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0"
21
19
  },
22
20
  "devDependencies": {
23
- "vite": "^7.3.6"
21
+ "vite": "^8.3.0"
24
22
  },
25
23
  "author": "Climate Interactive",
26
24
  "license": "MIT",
@@ -43,7 +41,7 @@
43
41
  "test:watch": "echo No tests yet",
44
42
  "test:ci": "echo No tests yet",
45
43
  "type-check": "tsc --noEmit -p tsconfig-test.json",
46
- "build": "tsup",
44
+ "build": "tsdown",
47
45
  "docs": "../../scripts/gen-docs.js",
48
46
  "ci:build": "run-s clean lint prettier:check test:ci type-check build docs"
49
47
  }
package/dist/index.cjs DELETED
@@ -1,72 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/index.ts
20
- var index_exports = {};
21
- __export(index_exports, {
22
- vitePlugin: () => vitePlugin
23
- });
24
- module.exports = __toCommonJS(index_exports);
25
-
26
- // src/plugin.ts
27
- var import_vite = require("vite");
28
- function vitePlugin(options) {
29
- return new VitePlugin(options);
30
- }
31
- var VitePlugin = class {
32
- constructor(options) {
33
- this.options = options;
34
- }
35
- async postGenerate(context) {
36
- return this.buildIfNeeded(context, "post-generate");
37
- }
38
- async postBuild(context) {
39
- return this.buildIfNeeded(context, "post-build");
40
- }
41
- async buildIfNeeded(context, caller) {
42
- const applyDev = this.options.apply?.development || "post-build";
43
- const applyProd = this.options.apply?.production || "post-build";
44
- const shouldBuild = context.config.mode === "development" && applyDev === caller || context.config.mode === "production" && applyProd === caller;
45
- if (shouldBuild) {
46
- context.log("info", `Building ${this.options.name}`);
47
- await (0, import_vite.build)(this.options.config);
48
- }
49
- return true;
50
- }
51
- async watch() {
52
- if (this.options.apply?.development === "serve") {
53
- const server = await (0, import_vite.createServer)(this.options.config);
54
- await server.listen();
55
- } else if (this.options.apply?.development === "watch") {
56
- const config = {
57
- build: {
58
- // Enable watch mode
59
- // TODO: Only do this if not already set up in the given config?
60
- watch: {}
61
- },
62
- ...this.options.config
63
- };
64
- await (0, import_vite.build)(config);
65
- }
66
- }
67
- };
68
- // Annotate the CommonJS export names for ESM import in node:
69
- 0 && (module.exports = {
70
- vitePlugin
71
- });
72
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts","../src/plugin.ts"],"sourcesContent":["// Copyright (c) 2022 Climate Interactive / New Venture Fund\n\nexport type { VitePluginOptions } from './options'\nexport { vitePlugin } from './plugin'\n","// Copyright (c) 2022 Climate Interactive / New Venture Fund\n\nimport type { InlineConfig, ViteDevServer } from 'vite'\nimport { build, createServer } from 'vite'\n\nimport type { BuildContext, Plugin } from '@sdeverywhere/build'\n\nimport type { VitePluginOptions } from './options'\n\nexport function vitePlugin(options: VitePluginOptions): Plugin {\n return new VitePlugin(options)\n}\n\nclass VitePlugin implements Plugin {\n constructor(private readonly options: VitePluginOptions) {}\n\n async postGenerate(context: BuildContext): Promise<boolean> {\n // Only build if the plugin is configured to run for 'post-generate'\n return this.buildIfNeeded(context, 'post-generate')\n }\n\n async postBuild(context: BuildContext): Promise<boolean> {\n // Only build if the plugin is configured to run for 'post-build'\n return this.buildIfNeeded(context, 'post-build')\n }\n\n private async buildIfNeeded(context: BuildContext, caller: 'post-generate' | 'post-build'): Promise<boolean> {\n // The apply values default to 'post-build' when left undefined\n const applyDev = this.options.apply?.development || 'post-build'\n const applyProd = this.options.apply?.production || 'post-build'\n\n // Run \"vite build\" only if configured for this mode\n const shouldBuild =\n (context.config.mode === 'development' && applyDev === caller) ||\n (context.config.mode === 'production' && applyProd === caller)\n if (shouldBuild) {\n context.log('info', `Building ${this.options.name}`)\n await build(this.options.config)\n // context.log('info', 'Done!')\n }\n return true\n }\n\n async watch(): Promise<void> {\n if (this.options.apply?.development === 'serve') {\n // Run \"vite dev\", which starts the app in a local server and\n // refreshes when source files are changed\n const server: ViteDevServer = await createServer(this.options.config)\n await server.listen()\n } else if (this.options.apply?.development === 'watch') {\n // Run \"vite build\" in watch mode so that it rebuilds when source\n // files are changed\n const config: InlineConfig = {\n build: {\n // Enable watch mode\n // TODO: Only do this if not already set up in the given config?\n watch: {}\n },\n ...this.options.config\n }\n await build(config)\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,kBAAoC;AAM7B,SAAS,WAAW,SAAoC;AAC7D,SAAO,IAAI,WAAW,OAAO;AAC/B;AAEA,IAAM,aAAN,MAAmC;AAAA,EACjC,YAA6B,SAA4B;AAA5B;AAAA,EAA6B;AAAA,EAE1D,MAAM,aAAa,SAAyC;AAE1D,WAAO,KAAK,cAAc,SAAS,eAAe;AAAA,EACpD;AAAA,EAEA,MAAM,UAAU,SAAyC;AAEvD,WAAO,KAAK,cAAc,SAAS,YAAY;AAAA,EACjD;AAAA,EAEA,MAAc,cAAc,SAAuB,QAA0D;AAE3G,UAAM,WAAW,KAAK,QAAQ,OAAO,eAAe;AACpD,UAAM,YAAY,KAAK,QAAQ,OAAO,cAAc;AAGpD,UAAM,cACH,QAAQ,OAAO,SAAS,iBAAiB,aAAa,UACtD,QAAQ,OAAO,SAAS,gBAAgB,cAAc;AACzD,QAAI,aAAa;AACf,cAAQ,IAAI,QAAQ,YAAY,KAAK,QAAQ,IAAI,EAAE;AACnD,gBAAM,mBAAM,KAAK,QAAQ,MAAM;AAAA,IAEjC;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,QAAuB;AAC3B,QAAI,KAAK,QAAQ,OAAO,gBAAgB,SAAS;AAG/C,YAAM,SAAwB,UAAM,0BAAa,KAAK,QAAQ,MAAM;AACpE,YAAM,OAAO,OAAO;AAAA,IACtB,WAAW,KAAK,QAAQ,OAAO,gBAAgB,SAAS;AAGtD,YAAM,SAAuB;AAAA,QAC3B,OAAO;AAAA;AAAA;AAAA,UAGL,OAAO,CAAC;AAAA,QACV;AAAA,QACA,GAAG,KAAK,QAAQ;AAAA,MAClB;AACA,gBAAM,mBAAM,MAAM;AAAA,IACpB;AAAA,EACF;AACF;","names":[]}
package/dist/index.d.cts DELETED
@@ -1,40 +0,0 @@
1
- import { InlineConfig } from 'vite';
2
- import { Plugin } from '@sdeverywhere/build';
3
-
4
- interface VitePluginOptions {
5
- /** The name to include in log messages. */
6
- name: string;
7
- /** The Vite config to use. */
8
- config: InlineConfig;
9
- /** Specifies the behavior of the plugin for different `sde` build modes. */
10
- apply?: {
11
- /**
12
- * The behavior of the plugin when sde is configured for development mode.
13
- *
14
- * If left undefined, defaults to 'post-build'.
15
- *
16
- * - `skip`: Don't run the plugin.
17
- * - `post-generate`: Run `vite build` in the `postGenerate` phase.
18
- * - `post-build`: Run `vite build` in the `postBuild` phase.
19
- * - `watch`: Run `vite build` in the `watch` callback (rebuilds the library when
20
- * changes are detected in source files); useful for libraries.
21
- * - `serve`: Run `vite dev` (sets up local server and refreshes the app
22
- * automatically when changes are detected); useful for applications.
23
- */
24
- development?: 'skip' | 'post-generate' | 'post-build' | 'watch' | 'serve';
25
- /**
26
- * The behavior of the plugin when sde is configured for production mode.
27
- *
28
- * If left undefined, defaults to 'post-build'.
29
- *
30
- * - `skip`: Don't run the plugin.
31
- * - `post-generate`: Run `vite build` in the `postGenerate` phase.
32
- * - `post-build`: Run `vite build` in the `postBuild` phase.
33
- */
34
- production?: 'skip' | 'post-generate' | 'post-build';
35
- };
36
- }
37
-
38
- declare function vitePlugin(options: VitePluginOptions): Plugin;
39
-
40
- export { type VitePluginOptions, vitePlugin };