unplugin-build-meta 0.1.0 → 0.3.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.
Files changed (55) hide show
  1. package/README.md +35 -2
  2. package/dist/astro.cjs +3 -3
  3. package/dist/astro.d.cts +1 -1
  4. package/dist/astro.d.ts +1 -1
  5. package/dist/astro.mjs +1 -1
  6. package/dist/{chunk-BJB5XFUG.mjs → chunk-CXRRUAJM.mjs} +1 -1
  7. package/dist/{chunk-2TPIXTEW.cjs → chunk-IO4OWFHV.cjs} +25 -9
  8. package/dist/{chunk-MMKRPHVS.mjs → chunk-MXB5NLXO.mjs} +25 -9
  9. package/dist/{chunk-FH2TLW2E.cjs → chunk-NT6BOYSQ.cjs} +2 -2
  10. package/dist/{chunk-YRRFFWQG.mjs → chunk-QCK7NEYC.mjs} +1 -1
  11. package/dist/{chunk-VL4NLRZW.cjs → chunk-TQTDIF6M.cjs} +2 -2
  12. package/dist/esbuild.cjs +2 -2
  13. package/dist/esbuild.d.cts +1 -1
  14. package/dist/esbuild.d.ts +1 -1
  15. package/dist/esbuild.mjs +1 -1
  16. package/dist/farm.cjs +2 -2
  17. package/dist/farm.d.cts +1 -1
  18. package/dist/farm.d.ts +1 -1
  19. package/dist/farm.mjs +1 -1
  20. package/dist/index.cjs +2 -2
  21. package/dist/index.d.cts +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.mjs +1 -1
  24. package/dist/module.d.cts +1 -1
  25. package/dist/module.d.ts +1 -1
  26. package/dist/nuxt.cjs +7 -7
  27. package/dist/nuxt.d.cts +1 -1
  28. package/dist/nuxt.d.ts +1 -1
  29. package/dist/nuxt.mjs +3 -3
  30. package/dist/rolldown.cjs +2 -2
  31. package/dist/rolldown.d.cts +1 -1
  32. package/dist/rolldown.d.ts +1 -1
  33. package/dist/rolldown.mjs +1 -1
  34. package/dist/rollup.cjs +2 -2
  35. package/dist/rollup.d.cts +1 -1
  36. package/dist/rollup.d.ts +1 -1
  37. package/dist/rollup.mjs +1 -1
  38. package/dist/rspack.cjs +2 -2
  39. package/dist/rspack.d.cts +1 -1
  40. package/dist/rspack.d.ts +1 -1
  41. package/dist/rspack.mjs +1 -1
  42. package/dist/{types-dRhtxdLo.d.cts → types-C-6IiPYY.d.cts} +12 -4
  43. package/dist/{types-dRhtxdLo.d.ts → types-C-6IiPYY.d.ts} +12 -4
  44. package/dist/vite.cjs +3 -3
  45. package/dist/vite.d.cts +1 -1
  46. package/dist/vite.d.ts +1 -1
  47. package/dist/vite.mjs +2 -2
  48. package/dist/webpack.cjs +3 -3
  49. package/dist/webpack.d.cts +1 -1
  50. package/dist/webpack.d.ts +1 -1
  51. package/dist/webpack.mjs +2 -2
  52. package/package.json +3 -7
  53. package/types/git.d.ts +2 -1
  54. package/types/index.d.ts +1 -1
  55. package/types/runtime.d.ts +9 -0
package/README.md CHANGED
@@ -7,7 +7,7 @@ Import build metadata into your JavaScript/TypeScript projects for Vite, Webpack
7
7
 
8
8
  <p align="center">
9
9
  <br />
10
- <a href="https://stackblitz.com/github/luxass/unplugin-build-meta/tree/main/examples/vite-vue?file=vite.config.ts"><img src="https://developer.stackblitz.com/img/open_in_stackblitz.svg" /></a>
10
+ <a href="https://stackblitz.com/github/luxass/unplugin-build-meta/tree/main/examples/vite?file=vite.config.ts"><img src="https://developer.stackblitz.com/img/open_in_stackblitz.svg" /></a>
11
11
  </p>
12
12
 
13
13
  ## Install
@@ -190,10 +190,21 @@ export default defineConfig({
190
190
 
191
191
  ```ts
192
192
  buildMeta({
193
- modules: ["git"] // Configure which modules to include
193
+ // Whether to enable the git module (enabled by default)
194
+ git: true,
195
+
196
+ // Additional custom modules to include
197
+ extraModules: [
198
+ // Your custom modules here
199
+ ]
194
200
  });
195
201
  ```
196
202
 
203
+ By default, the git module is enabled. You can:
204
+ - Disable the git module by setting `git: false`
205
+ - Add custom modules using the `extraModules` array
206
+ - Create custom modules using `defineBuildMetaModule`
207
+
197
208
  ## Modules
198
209
 
199
210
  ### Git Module
@@ -229,6 +240,28 @@ Available properties (all properties are nullable):
229
240
  | `lastTag` | `string \| null` | Latest tag in the repository |
230
241
  | `repositoryUrl` | `string \| null` | Repository URL (for GitHub repositories) |
231
242
 
243
+ ### Runtime Module
244
+
245
+ The runtime module provides access to Node.js runtime information from your code.
246
+
247
+ Import it in your code:
248
+
249
+ ```ts
250
+ // Import all runtime information
251
+ import * as runtime from "virtual:build-meta/runtime";
252
+
253
+ // Or import specific values
254
+ import { arch, platform, versions } from "virtual:build-meta/runtime";
255
+ ```
256
+
257
+ Available properties:
258
+
259
+ | Property | Type | Description |
260
+ |----------|------|-------------|
261
+ | `platform` | `NodeJS.Platform` | The operating system platform (e.g., 'linux', 'darwin', 'win32') |
262
+ | `arch` | `NodeJS.Architecture` | The CPU architecture (e.g., 'x64', 'arm64') |
263
+ | `versions` | `NodeJS.ProcessVersions` | Version strings of Node.js and its dependencies |
264
+
232
265
  ### TypeScript
233
266
 
234
267
  To get proper type support, make sure to include the type declarations:
package/dist/astro.cjs CHANGED
@@ -1,17 +1,17 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunk2TPIXTEWcjs = require('./chunk-2TPIXTEW.cjs');
4
+ var _chunkIO4OWFHVcjs = require('./chunk-IO4OWFHV.cjs');
5
5
  require('./chunk-SSXJV7C2.cjs');
6
6
 
7
7
  // src/astro.ts
8
8
  function BuildMetaIntegration(options) {
9
9
  return {
10
- name: _chunk2TPIXTEWcjs.PLUGIN_NAME,
10
+ name: _chunkIO4OWFHVcjs.PLUGIN_NAME,
11
11
  hooks: {
12
12
  "astro:config:setup": async (astro) => {
13
13
  astro.config.vite.plugins ||= [];
14
- astro.config.vite.plugins.push(_chunk2TPIXTEWcjs.unplugin.vite(options));
14
+ astro.config.vite.plugins.push(_chunkIO4OWFHVcjs.unplugin.vite(options));
15
15
  }
16
16
  }
17
17
  };
package/dist/astro.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AstroIntegration } from 'astro';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.cjs';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.cjs';
3
3
  import 'unplugin';
4
4
 
5
5
  /**
package/dist/astro.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AstroIntegration } from 'astro';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.js';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.js';
3
3
  import 'unplugin';
4
4
 
5
5
  /**
package/dist/astro.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PLUGIN_NAME,
3
3
  unplugin
4
- } from "./chunk-MMKRPHVS.mjs";
4
+ } from "./chunk-MXB5NLXO.mjs";
5
5
  import "./chunk-RJEZ2A3A.mjs";
6
6
 
7
7
  // src/astro.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-MMKRPHVS.mjs";
3
+ } from "./chunk-MXB5NLXO.mjs";
4
4
 
5
5
  // src/webpack.ts
6
6
  import { createWebpackPlugin } from "unplugin";
@@ -103,21 +103,37 @@ var git_default = _chunkSSXJV7C2cjs.defineBuildMetaModule.call(void 0, {
103
103
  }
104
104
  });
105
105
 
106
+ // src/core/modules/runtime.ts
107
+ var _process = require('process'); var _process2 = _interopRequireDefault(_process);
108
+ var runtimeModule = {
109
+ name: "runtime",
110
+ load: async () => {
111
+ const runtime = {
112
+ platform: _process2.default.platform,
113
+ arch: _process2.default.arch,
114
+ versions: _process2.default.versions
115
+ };
116
+ return [
117
+ `export const platform = ${JSON.stringify(runtime.platform)}`,
118
+ `export const arch = ${JSON.stringify(runtime.arch)}`,
119
+ `export const versions = ${JSON.stringify(runtime.versions, null, 2)}`
120
+ ].join("\n");
121
+ }
122
+ };
123
+
106
124
  // src/core/index.ts
107
125
  var PREFIX = "virtual:build-meta/";
108
126
  var PREFIX_WITH_NULL = `\0${PREFIX}`;
109
127
  var unpluginFactory = (options = {}) => {
110
- const { modules: _modules = [] } = options;
128
+ const { git = true, extraModules = [], runtime = true } = options;
111
129
  const modules = [];
112
- for (const module of _modules) {
113
- if (typeof module === "object" && "name" in module) {
114
- modules.push(module);
115
- continue;
116
- }
117
- if (module === "git") {
118
- modules.push(git_default);
119
- }
130
+ if (git) {
131
+ modules.push(git_default);
132
+ }
133
+ if (runtime) {
134
+ modules.push(runtimeModule);
120
135
  }
136
+ modules.push(...extraModules);
121
137
  return {
122
138
  name: PLUGIN_NAME,
123
139
  enforce: "pre",
@@ -103,21 +103,37 @@ var git_default = defineBuildMetaModule({
103
103
  }
104
104
  });
105
105
 
106
+ // src/core/modules/runtime.ts
107
+ import process from "node:process";
108
+ var runtimeModule = {
109
+ name: "runtime",
110
+ load: async () => {
111
+ const runtime = {
112
+ platform: process.platform,
113
+ arch: process.arch,
114
+ versions: process.versions
115
+ };
116
+ return [
117
+ `export const platform = ${JSON.stringify(runtime.platform)}`,
118
+ `export const arch = ${JSON.stringify(runtime.arch)}`,
119
+ `export const versions = ${JSON.stringify(runtime.versions, null, 2)}`
120
+ ].join("\n");
121
+ }
122
+ };
123
+
106
124
  // src/core/index.ts
107
125
  var PREFIX = "virtual:build-meta/";
108
126
  var PREFIX_WITH_NULL = `\0${PREFIX}`;
109
127
  var unpluginFactory = (options = {}) => {
110
- const { modules: _modules = [] } = options;
128
+ const { git = true, extraModules = [], runtime = true } = options;
111
129
  const modules = [];
112
- for (const module of _modules) {
113
- if (typeof module === "object" && "name" in module) {
114
- modules.push(module);
115
- continue;
116
- }
117
- if (module === "git") {
118
- modules.push(git_default);
119
- }
130
+ if (git) {
131
+ modules.push(git_default);
132
+ }
133
+ if (runtime) {
134
+ modules.push(runtimeModule);
120
135
  }
136
+ modules.push(...extraModules);
121
137
  return {
122
138
  name: PLUGIN_NAME,
123
139
  enforce: "pre",
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk2TPIXTEWcjs = require('./chunk-2TPIXTEW.cjs');
3
+ var _chunkIO4OWFHVcjs = require('./chunk-IO4OWFHV.cjs');
4
4
 
5
5
  // src/vite.ts
6
6
  var _unplugin = require('unplugin');
7
- var vite_default = _unplugin.createVitePlugin.call(void 0, _chunk2TPIXTEWcjs.unpluginFactory);
7
+ var vite_default = _unplugin.createVitePlugin.call(void 0, _chunkIO4OWFHVcjs.unpluginFactory);
8
8
 
9
9
 
10
10
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-MMKRPHVS.mjs";
3
+ } from "./chunk-MXB5NLXO.mjs";
4
4
 
5
5
  // src/vite.ts
6
6
  import { createVitePlugin } from "unplugin";
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk2TPIXTEWcjs = require('./chunk-2TPIXTEW.cjs');
3
+ var _chunkIO4OWFHVcjs = require('./chunk-IO4OWFHV.cjs');
4
4
 
5
5
  // src/webpack.ts
6
6
  var _unplugin = require('unplugin');
7
- var webpack_default = _unplugin.createWebpackPlugin.call(void 0, _chunk2TPIXTEWcjs.unpluginFactory);
7
+ var webpack_default = _unplugin.createWebpackPlugin.call(void 0, _chunkIO4OWFHVcjs.unpluginFactory);
8
8
 
9
9
 
10
10
 
package/dist/esbuild.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk2TPIXTEWcjs = require('./chunk-2TPIXTEW.cjs');
3
+ var _chunkIO4OWFHVcjs = require('./chunk-IO4OWFHV.cjs');
4
4
  require('./chunk-SSXJV7C2.cjs');
5
5
 
6
6
  // src/esbuild.ts
7
7
  var _unplugin = require('unplugin');
8
- var esbuild_default = _unplugin.createEsbuildPlugin.call(void 0, _chunk2TPIXTEWcjs.unpluginFactory);
8
+ var esbuild_default = _unplugin.createEsbuildPlugin.call(void 0, _chunkIO4OWFHVcjs.unpluginFactory);
9
9
 
10
10
 
11
11
  exports.default = esbuild_default;
@@ -1,5 +1,5 @@
1
1
  import * as esbuild from 'esbuild';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.cjs';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.cjs';
3
3
  import 'unplugin';
4
4
 
5
5
  /**
package/dist/esbuild.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as esbuild from 'esbuild';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.js';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.js';
3
3
  import 'unplugin';
4
4
 
5
5
  /**
package/dist/esbuild.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-MMKRPHVS.mjs";
3
+ } from "./chunk-MXB5NLXO.mjs";
4
4
  import "./chunk-RJEZ2A3A.mjs";
5
5
 
6
6
  // src/esbuild.ts
package/dist/farm.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk2TPIXTEWcjs = require('./chunk-2TPIXTEW.cjs');
3
+ var _chunkIO4OWFHVcjs = require('./chunk-IO4OWFHV.cjs');
4
4
  require('./chunk-SSXJV7C2.cjs');
5
5
 
6
6
  // src/farm.ts
7
7
  var _unplugin = require('unplugin');
8
- var farm_default = _unplugin.createFarmPlugin.call(void 0, _chunk2TPIXTEWcjs.unpluginFactory);
8
+ var farm_default = _unplugin.createFarmPlugin.call(void 0, _chunkIO4OWFHVcjs.unpluginFactory);
9
9
 
10
10
 
11
11
  exports.default = farm_default;
package/dist/farm.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { B as BuildMetaOptions } from './types-dRhtxdLo.cjs';
1
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.cjs';
2
2
  import 'unplugin';
3
3
 
4
4
  /**
package/dist/farm.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { B as BuildMetaOptions } from './types-dRhtxdLo.js';
1
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.js';
2
2
  import 'unplugin';
3
3
 
4
4
  /**
package/dist/farm.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-MMKRPHVS.mjs";
3
+ } from "./chunk-MXB5NLXO.mjs";
4
4
  import "./chunk-RJEZ2A3A.mjs";
5
5
 
6
6
  // src/farm.ts
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunk2TPIXTEWcjs = require('./chunk-2TPIXTEW.cjs');
4
+ var _chunkIO4OWFHVcjs = require('./chunk-IO4OWFHV.cjs');
5
5
  require('./chunk-SSXJV7C2.cjs');
6
6
 
7
7
 
8
8
 
9
- exports.unplugin = _chunk2TPIXTEWcjs.unplugin; exports.unpluginFactory = _chunk2TPIXTEWcjs.unpluginFactory;
9
+ exports.unplugin = _chunkIO4OWFHVcjs.unplugin; exports.unpluginFactory = _chunkIO4OWFHVcjs.unpluginFactory;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { UnpluginFactory, UnpluginInstance } from 'unplugin';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.cjs';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.cjs';
3
3
 
4
4
  /**
5
5
  * A unplugin factory, used by Unplugin to create a new plugin instance.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { UnpluginFactory, UnpluginInstance } from 'unplugin';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.js';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.js';
3
3
 
4
4
  /**
5
5
  * A unplugin factory, used by Unplugin to create a new plugin instance.
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unplugin,
3
3
  unpluginFactory
4
- } from "./chunk-MMKRPHVS.mjs";
4
+ } from "./chunk-MXB5NLXO.mjs";
5
5
  import "./chunk-RJEZ2A3A.mjs";
6
6
  export {
7
7
  unplugin,
package/dist/module.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as BuildMetaModule } from './types-dRhtxdLo.cjs';
1
+ import { a as BuildMetaModule } from './types-C-6IiPYY.cjs';
2
2
  import 'unplugin';
3
3
 
4
4
  /**
package/dist/module.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as BuildMetaModule } from './types-dRhtxdLo.js';
1
+ import { a as BuildMetaModule } from './types-C-6IiPYY.js';
2
2
  import 'unplugin';
3
3
 
4
4
  /**
package/dist/nuxt.cjs CHANGED
@@ -1,29 +1,29 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkFH2TLW2Ecjs = require('./chunk-FH2TLW2E.cjs');
3
+ var _chunkNT6BOYSQcjs = require('./chunk-NT6BOYSQ.cjs');
4
4
 
5
5
 
6
- var _chunkVL4NLRZWcjs = require('./chunk-VL4NLRZW.cjs');
6
+ var _chunkTQTDIF6Mcjs = require('./chunk-TQTDIF6M.cjs');
7
7
 
8
8
 
9
9
 
10
- var _chunk2TPIXTEWcjs = require('./chunk-2TPIXTEW.cjs');
10
+ var _chunkIO4OWFHVcjs = require('./chunk-IO4OWFHV.cjs');
11
11
  require('./chunk-SSXJV7C2.cjs');
12
12
 
13
13
  // src/nuxt.ts
14
14
  var _kit = require('@nuxt/kit');
15
15
  var nuxt_default = _kit.defineNuxtModule.call(void 0, {
16
16
  meta: {
17
- name: _chunk2TPIXTEWcjs.PLUGIN_NAME,
18
- configKey: _chunk2TPIXTEWcjs.NUXT_CONFIG_KEY
17
+ name: _chunkIO4OWFHVcjs.PLUGIN_NAME,
18
+ configKey: _chunkIO4OWFHVcjs.NUXT_CONFIG_KEY
19
19
  },
20
20
  setup(options, nuxt) {
21
21
  nuxt.options.typescript.tsConfig ||= {};
22
22
  nuxt.options.typescript.tsConfig.compilerOptions ||= {};
23
23
  nuxt.options.typescript.tsConfig.compilerOptions.types ||= [];
24
24
  nuxt.options.typescript.tsConfig.compilerOptions.types.push("unplugin-build-meta/types");
25
- _kit.addWebpackPlugin.call(void 0, () => _chunkVL4NLRZWcjs.webpack_default.call(void 0, options));
26
- _kit.addVitePlugin.call(void 0, () => _chunkFH2TLW2Ecjs.vite_default.call(void 0, options));
25
+ _kit.addWebpackPlugin.call(void 0, () => _chunkTQTDIF6Mcjs.webpack_default.call(void 0, options));
26
+ _kit.addVitePlugin.call(void 0, () => _chunkNT6BOYSQcjs.vite_default.call(void 0, options));
27
27
  }
28
28
  });
29
29
 
package/dist/nuxt.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { NuxtModule } from '@nuxt/schema';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.cjs';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.cjs';
3
3
  import 'unplugin';
4
4
 
5
5
  /**
package/dist/nuxt.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { NuxtModule } from '@nuxt/schema';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.js';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.js';
3
3
  import 'unplugin';
4
4
 
5
5
  /**
package/dist/nuxt.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  vite_default
3
- } from "./chunk-YRRFFWQG.mjs";
3
+ } from "./chunk-QCK7NEYC.mjs";
4
4
  import {
5
5
  webpack_default
6
- } from "./chunk-BJB5XFUG.mjs";
6
+ } from "./chunk-CXRRUAJM.mjs";
7
7
  import {
8
8
  NUXT_CONFIG_KEY,
9
9
  PLUGIN_NAME
10
- } from "./chunk-MMKRPHVS.mjs";
10
+ } from "./chunk-MXB5NLXO.mjs";
11
11
  import "./chunk-RJEZ2A3A.mjs";
12
12
 
13
13
  // src/nuxt.ts
package/dist/rolldown.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk2TPIXTEWcjs = require('./chunk-2TPIXTEW.cjs');
3
+ var _chunkIO4OWFHVcjs = require('./chunk-IO4OWFHV.cjs');
4
4
  require('./chunk-SSXJV7C2.cjs');
5
5
 
6
6
  // src/rolldown.ts
7
7
  var _unplugin = require('unplugin');
8
- var rolldown_default = _unplugin.createRolldownPlugin.call(void 0, _chunk2TPIXTEWcjs.unpluginFactory);
8
+ var rolldown_default = _unplugin.createRolldownPlugin.call(void 0, _chunkIO4OWFHVcjs.unpluginFactory);
9
9
 
10
10
 
11
11
  exports.default = rolldown_default;
@@ -1,5 +1,5 @@
1
1
  import * as rolldown from 'rolldown';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.cjs';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.cjs';
3
3
  import 'unplugin';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import * as rolldown from 'rolldown';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.js';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.js';
3
3
  import 'unplugin';
4
4
 
5
5
  /**
package/dist/rolldown.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-MMKRPHVS.mjs";
3
+ } from "./chunk-MXB5NLXO.mjs";
4
4
  import "./chunk-RJEZ2A3A.mjs";
5
5
 
6
6
  // src/rolldown.ts
package/dist/rollup.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk2TPIXTEWcjs = require('./chunk-2TPIXTEW.cjs');
3
+ var _chunkIO4OWFHVcjs = require('./chunk-IO4OWFHV.cjs');
4
4
  require('./chunk-SSXJV7C2.cjs');
5
5
 
6
6
  // src/rollup.ts
7
7
  var _unplugin = require('unplugin');
8
- var rollup_default = _unplugin.createRollupPlugin.call(void 0, _chunk2TPIXTEWcjs.unpluginFactory);
8
+ var rollup_default = _unplugin.createRollupPlugin.call(void 0, _chunkIO4OWFHVcjs.unpluginFactory);
9
9
 
10
10
 
11
11
  exports.default = rollup_default;
package/dist/rollup.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as rollup from 'rollup';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.cjs';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.cjs';
3
3
  import 'unplugin';
4
4
 
5
5
  /**
package/dist/rollup.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as rollup from 'rollup';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.js';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.js';
3
3
  import 'unplugin';
4
4
 
5
5
  /**
package/dist/rollup.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-MMKRPHVS.mjs";
3
+ } from "./chunk-MXB5NLXO.mjs";
4
4
  import "./chunk-RJEZ2A3A.mjs";
5
5
 
6
6
  // src/rollup.ts
package/dist/rspack.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk2TPIXTEWcjs = require('./chunk-2TPIXTEW.cjs');
3
+ var _chunkIO4OWFHVcjs = require('./chunk-IO4OWFHV.cjs');
4
4
  require('./chunk-SSXJV7C2.cjs');
5
5
 
6
6
  // src/rspack.ts
7
7
  var _unplugin = require('unplugin');
8
- var rspack_default = _unplugin.createRspackPlugin.call(void 0, _chunk2TPIXTEWcjs.unpluginFactory);
8
+ var rspack_default = _unplugin.createRspackPlugin.call(void 0, _chunkIO4OWFHVcjs.unpluginFactory);
9
9
 
10
10
 
11
11
  exports.default = rspack_default;
package/dist/rspack.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as unplugin from 'unplugin';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.cjs';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.cjs';
3
3
 
4
4
  /**
5
5
  * This entry file is for Rspack plugin.
package/dist/rspack.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as unplugin from 'unplugin';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.js';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.js';
3
3
 
4
4
  /**
5
5
  * This entry file is for Rspack plugin.
package/dist/rspack.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-MMKRPHVS.mjs";
3
+ } from "./chunk-MXB5NLXO.mjs";
4
4
  import "./chunk-RJEZ2A3A.mjs";
5
5
 
6
6
  // src/rspack.ts
@@ -1,16 +1,24 @@
1
1
  import { UnpluginBuildContext, UnpluginContext } from 'unplugin';
2
2
 
3
- type Module = "git";
4
3
  interface BuildMetaModule {
5
4
  name: string;
6
5
  load: (ctx: UnpluginBuildContext & UnpluginContext, id: string) => Promise<string>;
7
6
  }
8
7
  interface BuildMetaOptions {
9
8
  /**
10
- * Which modules to include in the build meta.
11
- * By default `all` modules are included.
9
+ * Whether to enable the git module.
10
+ * @default true
12
11
  */
13
- modules?: (Module | BuildMetaModule)[];
12
+ git?: boolean;
13
+ /**
14
+ * Whether to enable the runtime module.
15
+ * @default true
16
+ */
17
+ runtime?: boolean;
18
+ /**
19
+ * Additional custom modules to include in the build meta.
20
+ */
21
+ extraModules?: BuildMetaModule[];
14
22
  }
15
23
 
16
24
  export type { BuildMetaOptions as B, BuildMetaModule as a };
@@ -1,16 +1,24 @@
1
1
  import { UnpluginBuildContext, UnpluginContext } from 'unplugin';
2
2
 
3
- type Module = "git";
4
3
  interface BuildMetaModule {
5
4
  name: string;
6
5
  load: (ctx: UnpluginBuildContext & UnpluginContext, id: string) => Promise<string>;
7
6
  }
8
7
  interface BuildMetaOptions {
9
8
  /**
10
- * Which modules to include in the build meta.
11
- * By default `all` modules are included.
9
+ * Whether to enable the git module.
10
+ * @default true
12
11
  */
13
- modules?: (Module | BuildMetaModule)[];
12
+ git?: boolean;
13
+ /**
14
+ * Whether to enable the runtime module.
15
+ * @default true
16
+ */
17
+ runtime?: boolean;
18
+ /**
19
+ * Additional custom modules to include in the build meta.
20
+ */
21
+ extraModules?: BuildMetaModule[];
14
22
  }
15
23
 
16
24
  export type { BuildMetaOptions as B, BuildMetaModule as a };
package/dist/vite.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkFH2TLW2Ecjs = require('./chunk-FH2TLW2E.cjs');
4
- require('./chunk-2TPIXTEW.cjs');
3
+ var _chunkNT6BOYSQcjs = require('./chunk-NT6BOYSQ.cjs');
4
+ require('./chunk-IO4OWFHV.cjs');
5
5
  require('./chunk-SSXJV7C2.cjs');
6
6
 
7
7
 
8
- exports.default = _chunkFH2TLW2Ecjs.vite_default;
8
+ exports.default = _chunkNT6BOYSQcjs.vite_default;
package/dist/vite.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vite from 'vite';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.cjs';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.cjs';
3
3
  import 'unplugin';
4
4
 
5
5
  /**
package/dist/vite.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vite from 'vite';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.js';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.js';
3
3
  import 'unplugin';
4
4
 
5
5
  /**
package/dist/vite.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  vite_default
3
- } from "./chunk-YRRFFWQG.mjs";
4
- import "./chunk-MMKRPHVS.mjs";
3
+ } from "./chunk-QCK7NEYC.mjs";
4
+ import "./chunk-MXB5NLXO.mjs";
5
5
  import "./chunk-RJEZ2A3A.mjs";
6
6
  export {
7
7
  vite_default as default
package/dist/webpack.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkVL4NLRZWcjs = require('./chunk-VL4NLRZW.cjs');
4
- require('./chunk-2TPIXTEW.cjs');
3
+ var _chunkTQTDIF6Mcjs = require('./chunk-TQTDIF6M.cjs');
4
+ require('./chunk-IO4OWFHV.cjs');
5
5
  require('./chunk-SSXJV7C2.cjs');
6
6
 
7
7
 
8
- exports.default = _chunkVL4NLRZWcjs.webpack_default;
8
+ exports.default = _chunkTQTDIF6Mcjs.webpack_default;
@@ -1,5 +1,5 @@
1
1
  import * as webpack from 'webpack';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.cjs';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.cjs';
3
3
  import 'unplugin';
4
4
 
5
5
  /**
package/dist/webpack.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as webpack from 'webpack';
2
- import { B as BuildMetaOptions } from './types-dRhtxdLo.js';
2
+ import { B as BuildMetaOptions } from './types-C-6IiPYY.js';
3
3
  import 'unplugin';
4
4
 
5
5
  /**
package/dist/webpack.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  webpack_default
3
- } from "./chunk-BJB5XFUG.mjs";
4
- import "./chunk-MMKRPHVS.mjs";
3
+ } from "./chunk-CXRRUAJM.mjs";
4
+ import "./chunk-MXB5NLXO.mjs";
5
5
  import "./chunk-RJEZ2A3A.mjs";
6
6
  export {
7
7
  webpack_default as default
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unplugin-build-meta",
3
- "version": "0.1.0",
4
- "description": "Provide build metadata (git info, etc.) to your JavaScript/TypeScript projects",
3
+ "version": "0.3.0",
4
+ "description": "Provide build metadata as a virutal module",
5
5
  "type": "module",
6
6
  "author": {
7
7
  "name": "Lucas Nørgård",
@@ -214,11 +214,7 @@
214
214
  "test": "vitest --run",
215
215
  "test:watch": "vitest",
216
216
  "typecheck": "tsc --noEmit && pnpm -r typecheck",
217
- "play:nuxt": "pnpm run --filter @unplugin-build-meta/nuxt dev",
218
- "play:vite-vue": "pnpm run --filter @unplugin-build-meta/vite-vue dev",
219
- "play:vite-react": "pnpm run --filter @unplugin-build-meta/vite-react dev",
220
- "play:nextjs": "pnpm run --filter @unplugin-build-meta/nextjs dev",
221
- "play:astro": "pnpm run --filter @unplugin-build-meta/astro dev",
217
+ "play:vite": "pnpm run --filter @unplugin-build-meta/vite dev",
222
218
  "play:rspack": "pnpm run --filter @unplugin-build-meta/rspack dev",
223
219
  "generate-types": "node scripts/generate-types.js"
224
220
  }
package/types/git.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // Auto-generated type definitions for unplugin-build-meta git module
2
- // Do not edit manually!
2
+ // Do not edit manually!
3
3
 
4
4
  declare module 'virtual:build-meta/git' {
5
5
  declare const branch: string | null;
@@ -17,3 +17,4 @@ declare module 'virtual:build-meta/git' {
17
17
  declare const lastTag: string | null;
18
18
  declare const repositoryUrl: string | null;
19
19
  }
20
+
package/types/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // Auto-generated type definitions for unplugin-build-meta
2
2
  // Do not edit manually!
3
3
 
4
- // Re-export git module types
5
4
  import './git';
5
+ import './runtime';
@@ -0,0 +1,9 @@
1
+ // Auto-generated type definitions for unplugin-build-meta git module
2
+ // Do not edit manually!
3
+
4
+ declare module 'virtual:build-meta/runtime' {
5
+ declare const platform: NodeJS.Platform;
6
+ declare const arch: NodeJS.Architecture;
7
+ declare const versions: NodeJS.ProcessVersions;
8
+ }
9
+