@blinkk/root 1.0.2 → 1.0.3

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getVitePlugins
3
- } from "./chunk-NCKNMVF6.js";
3
+ } from "./chunk-WHB5IDWW.js";
4
4
 
5
5
  // src/node/load-config.ts
6
6
  import path2 from "node:path";
@@ -264,4 +264,4 @@ export {
264
264
  createViteServer,
265
265
  viteSsrLoadModule
266
266
  };
267
- //# sourceMappingURL=chunk-UPYGHY3E.js.map
267
+ //# sourceMappingURL=chunk-CKQSZDR6.js.map
@@ -21,11 +21,11 @@ import {
21
21
  rmDir,
22
22
  writeFile,
23
23
  writeJson
24
- } from "./chunk-UPYGHY3E.js";
24
+ } from "./chunk-CKQSZDR6.js";
25
25
  import {
26
26
  configureServerPlugins,
27
27
  getVitePlugins
28
- } from "./chunk-NCKNMVF6.js";
28
+ } from "./chunk-WHB5IDWW.js";
29
29
  import {
30
30
  RouteTrie,
31
31
  htmlMinify,
@@ -1643,4 +1643,4 @@ export {
1643
1643
  createProdServer,
1644
1644
  CliRunner
1645
1645
  };
1646
- //# sourceMappingURL=chunk-HEP7AWOB.js.map
1646
+ //# sourceMappingURL=chunk-FANTUKAU.js.map
@@ -9,7 +9,7 @@ async function configureServerPlugins(server, callback, plugins, options) {
9
9
  postHooks.push(postHook);
10
10
  }
11
11
  }
12
- if (plugin.onFileChange) {
12
+ if (viteServer && plugin.onFileChange) {
13
13
  viteServer.watcher.on("all", plugin.onFileChange);
14
14
  }
15
15
  }
@@ -32,4 +32,4 @@ export {
32
32
  configureServerPlugins,
33
33
  getVitePlugins
34
34
  };
35
- //# sourceMappingURL=chunk-NCKNMVF6.js.map
35
+ //# sourceMappingURL=chunk-WHB5IDWW.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/plugin.ts"],"sourcesContent":["import {ViteDevServer, PluginOption as VitePlugin} from 'vite';\n\nimport {RootConfig} from './config';\nimport {Server} from './types';\n\ntype MaybePromise<T> = T | Promise<T>;\n\nexport type ConfigureServerHook = (\n server: Server,\n options: ConfigureServerOptions\n) => MaybePromise<void> | MaybePromise<() => void>;\n\nexport interface ConfigureServerOptions {\n type: 'dev' | 'preview' | 'prod';\n rootConfig: RootConfig;\n}\n\nexport interface Plugin {\n [key: string]: any;\n /** The name of the plugin. */\n name?: string;\n /**\n * Configures the root.js express server. Any middleware defined by the plugin\n * will be added to the server first. If a callback fn is returned, it will\n * be called after the root.js middlewares are added.\n */\n configureServer?: ConfigureServerHook;\n /**\n * Hook for file changes.\n */\n onFileChange?: (\n eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir',\n path: string\n ) => void;\n /**\n * Returns a list of deps to bundle for ssr. The files will be bundled and\n * output to `dist/server/`. The return value should be a map of\n * `{output filename => input filepath}`.\n *\n * E.g. a value of `{foo: 'path/to/bar.js'}` will output `dist/server/foo.js`.\n *\n * @experimental This config is subject to change to be incorporated into a\n * broader config option called \"ssr\" or \"ssrOptions\".\n */\n ssrInput?: () => {[entryAlias: string]: string};\n /** Adds vite plugins. */\n vitePlugins?: VitePlugin[];\n}\n\n/**\n * Runs the pre-hook configureServer method of every plugin, calls a callback\n * function, and then runs the configureServer's post-hook if provided. Plugins\n * provide a post-hook by returning a callback function from configureServer.\n */\nexport async function configureServerPlugins(\n server: Server,\n callback: () => Promise<void>,\n plugins: Plugin[],\n options: ConfigureServerOptions\n) {\n const postHooks: Array<() => void> = [];\n const viteServer = server.get('viteServer') as ViteDevServer;\n\n // Call the `configureServer()` method for each plugin.\n for (const plugin of plugins) {\n if (plugin.configureServer) {\n const postHook = await plugin.configureServer(server, options);\n if (postHook) {\n postHooks.push(postHook);\n }\n }\n\n if (plugin.onFileChange) {\n viteServer.watcher.on('all', plugin.onFileChange);\n }\n }\n\n // Register any built-in middleware.\n callback();\n\n // Run any post hooks returned by `plugin.configureServer()`.\n for (const postHook of postHooks) {\n await postHook();\n }\n}\n\nexport function getVitePlugins(plugins: Plugin[]): VitePlugin[] {\n const vitePlugins: VitePlugin[] = [];\n for (const plugin of plugins) {\n if (plugin.vitePlugins) {\n vitePlugins.push(...plugin.vitePlugins);\n }\n }\n return vitePlugins;\n}\n"],"mappings":";AAsDA,eAAsB,uBACpB,QACA,UACA,SACA,SACA;AACA,QAAM,YAA+B,CAAC;AACtC,QAAM,aAAa,OAAO,IAAI,YAAY;AAG1C,aAAW,UAAU,SAAS;AAC5B,QAAI,OAAO,iBAAiB;AAC1B,YAAM,WAAW,MAAM,OAAO,gBAAgB,QAAQ,OAAO;AAC7D,UAAI,UAAU;AACZ,kBAAU,KAAK,QAAQ;AAAA,MACzB;AAAA,IACF;AAEA,QAAI,OAAO,cAAc;AACvB,iBAAW,QAAQ,GAAG,OAAO,OAAO,YAAY;AAAA,IAClD;AAAA,EACF;AAGA,WAAS;AAGT,aAAW,YAAY,WAAW;AAChC,UAAM,SAAS;AAAA,EACjB;AACF;AAEO,SAAS,eAAe,SAAiC;AAC9D,QAAM,cAA4B,CAAC;AACnC,aAAW,UAAU,SAAS;AAC5B,QAAI,OAAO,aAAa;AACtB,kBAAY,KAAK,GAAG,OAAO,WAAW;AAAA,IACxC;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/core/plugin.ts"],"sourcesContent":["import {ViteDevServer, PluginOption as VitePlugin} from 'vite';\n\nimport {RootConfig} from './config';\nimport {Server} from './types';\n\ntype MaybePromise<T> = T | Promise<T>;\n\nexport type ConfigureServerHook = (\n server: Server,\n options: ConfigureServerOptions\n) => MaybePromise<void> | MaybePromise<() => void>;\n\nexport interface ConfigureServerOptions {\n type: 'dev' | 'preview' | 'prod';\n rootConfig: RootConfig;\n}\n\nexport interface Plugin {\n [key: string]: any;\n /** The name of the plugin. */\n name?: string;\n /**\n * Configures the root.js express server. Any middleware defined by the plugin\n * will be added to the server first. If a callback fn is returned, it will\n * be called after the root.js middlewares are added.\n */\n configureServer?: ConfigureServerHook;\n /**\n * Hook for file changes.\n */\n onFileChange?: (\n eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir',\n path: string\n ) => void;\n /**\n * Returns a list of deps to bundle for ssr. The files will be bundled and\n * output to `dist/server/`. The return value should be a map of\n * `{output filename => input filepath}`.\n *\n * E.g. a value of `{foo: 'path/to/bar.js'}` will output `dist/server/foo.js`.\n *\n * @experimental This config is subject to change to be incorporated into a\n * broader config option called \"ssr\" or \"ssrOptions\".\n */\n ssrInput?: () => {[entryAlias: string]: string};\n /** Adds vite plugins. */\n vitePlugins?: VitePlugin[];\n}\n\n/**\n * Runs the pre-hook configureServer method of every plugin, calls a callback\n * function, and then runs the configureServer's post-hook if provided. Plugins\n * provide a post-hook by returning a callback function from configureServer.\n */\nexport async function configureServerPlugins(\n server: Server,\n callback: () => Promise<void>,\n plugins: Plugin[],\n options: ConfigureServerOptions\n) {\n const postHooks: Array<() => void> = [];\n const viteServer = server.get('viteServer') as ViteDevServer;\n\n // Call the `configureServer()` method for each plugin.\n for (const plugin of plugins) {\n if (plugin.configureServer) {\n const postHook = await plugin.configureServer(server, options);\n if (postHook) {\n postHooks.push(postHook);\n }\n }\n\n if (viteServer && plugin.onFileChange) {\n viteServer.watcher.on('all', plugin.onFileChange);\n }\n }\n\n // Register any built-in middleware.\n callback();\n\n // Run any post hooks returned by `plugin.configureServer()`.\n for (const postHook of postHooks) {\n await postHook();\n }\n}\n\nexport function getVitePlugins(plugins: Plugin[]): VitePlugin[] {\n const vitePlugins: VitePlugin[] = [];\n for (const plugin of plugins) {\n if (plugin.vitePlugins) {\n vitePlugins.push(...plugin.vitePlugins);\n }\n }\n return vitePlugins;\n}\n"],"mappings":";AAsDA,eAAsB,uBACpB,QACA,UACA,SACA,SACA;AACA,QAAM,YAA+B,CAAC;AACtC,QAAM,aAAa,OAAO,IAAI,YAAY;AAG1C,aAAW,UAAU,SAAS;AAC5B,QAAI,OAAO,iBAAiB;AAC1B,YAAM,WAAW,MAAM,OAAO,gBAAgB,QAAQ,OAAO;AAC7D,UAAI,UAAU;AACZ,kBAAU,KAAK,QAAQ;AAAA,MACzB;AAAA,IACF;AAEA,QAAI,cAAc,OAAO,cAAc;AACrC,iBAAW,QAAQ,GAAG,OAAO,OAAO,YAAY;AAAA,IAClD;AAAA,EACF;AAGA,WAAS;AAGT,aAAW,YAAY,WAAW;AAChC,UAAM,SAAS;AAAA,EACjB;AACF;AAEO,SAAS,eAAe,SAAiC;AAC9D,QAAM,cAA4B,CAAC;AACnC,aAAW,UAAU,SAAS;AAC5B,QAAI,OAAO,aAAa;AACtB,kBAAY,KAAK,GAAG,OAAO,WAAW;AAAA,IACxC;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
package/dist/cli.js CHANGED
@@ -8,10 +8,10 @@ import {
8
8
  dev,
9
9
  preview,
10
10
  start
11
- } from "./chunk-HEP7AWOB.js";
11
+ } from "./chunk-FANTUKAU.js";
12
12
  import "./chunk-TZAHHHA4.js";
13
- import "./chunk-UPYGHY3E.js";
14
- import "./chunk-NCKNMVF6.js";
13
+ import "./chunk-CKQSZDR6.js";
14
+ import "./chunk-WHB5IDWW.js";
15
15
  import "./chunk-IUQLRDFW.js";
16
16
  export {
17
17
  CliRunner,
package/dist/core.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  configureServerPlugins,
3
3
  getVitePlugins
4
- } from "./chunk-NCKNMVF6.js";
4
+ } from "./chunk-WHB5IDWW.js";
5
5
  import {
6
6
  HTML_CONTEXT,
7
7
  Html,
package/dist/functions.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createPreviewServer,
3
3
  createProdServer
4
- } from "./chunk-HEP7AWOB.js";
4
+ } from "./chunk-FANTUKAU.js";
5
5
  import "./chunk-TZAHHHA4.js";
6
- import "./chunk-UPYGHY3E.js";
7
- import "./chunk-NCKNMVF6.js";
6
+ import "./chunk-CKQSZDR6.js";
7
+ import "./chunk-WHB5IDWW.js";
8
8
  import "./chunk-IUQLRDFW.js";
9
9
 
10
10
  // src/functions/server.ts
package/dist/node.js CHANGED
@@ -5,8 +5,8 @@ import {
5
5
  loadPackageJson,
6
6
  loadRootConfig,
7
7
  viteSsrLoadModule
8
- } from "./chunk-UPYGHY3E.js";
9
- import "./chunk-NCKNMVF6.js";
8
+ } from "./chunk-CKQSZDR6.js";
9
+ import "./chunk-WHB5IDWW.js";
10
10
  export {
11
11
  bundleRootConfig,
12
12
  createViteServer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkk/root",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "author": "s@blinkk.com",
5
5
  "license": "MIT",
6
6
  "engines": {