@blinkk/root 1.0.0-beta.0 → 1.0.0-beta.10

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/bin/root.js CHANGED
@@ -25,14 +25,17 @@ async function main() {
25
25
  program
26
26
  .command('dev [path]')
27
27
  .description('starts the server in development mode')
28
+ .option('--host <host>', 'network address the server should listen on, e.g. 127.0.0.1')
28
29
  .action(dev);
29
30
  program
30
31
  .command('preview [path]')
31
32
  .description('starts the server in preview mode')
33
+ .option('--host <host>', 'network address the server should listen on, e.g. 127.0.0.1')
32
34
  .action(preview);
33
35
  program
34
36
  .command('start [path]')
35
37
  .description('starts the server in production mode')
38
+ .option('--host <host>', 'network address the server should listen on, e.g. 127.0.0.1')
36
39
  .action(start);
37
40
  await program.parseAsync(process.argv);
38
41
  }
package/client.d.ts ADDED
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,150 @@
1
+ import {
2
+ getVitePlugins
3
+ } from "./chunk-DTEQ2AIW.js";
4
+
5
+ // src/node/load-config.ts
6
+ import path2 from "node:path";
7
+ import { bundleRequire } from "bundle-require";
8
+
9
+ // src/utils/fsutils.ts
10
+ import { promises as fs } from "node:fs";
11
+ import path from "node:path";
12
+ import fsExtra from "fs-extra";
13
+ import glob from "tiny-glob";
14
+ function isJsFile(filename) {
15
+ return !!filename.match(/\.(j|t)sx?$/);
16
+ }
17
+ async function writeFile(filepath, content) {
18
+ const dirPath = path.dirname(filepath);
19
+ await makeDir(dirPath);
20
+ await fs.writeFile(filepath, content);
21
+ }
22
+ async function makeDir(dirpath) {
23
+ try {
24
+ await fs.access(dirpath);
25
+ } catch (e) {
26
+ await fs.mkdir(dirpath, { recursive: true });
27
+ }
28
+ }
29
+ async function copyGlob(pattern, srcdir, dstdir) {
30
+ const files = await glob(pattern, { cwd: srcdir });
31
+ if (files.length > 0) {
32
+ await makeDir(dstdir);
33
+ }
34
+ files.forEach((file) => {
35
+ fsExtra.copySync(path.resolve(srcdir, file), path.resolve(dstdir, file));
36
+ });
37
+ }
38
+ async function rmDir(dirpath) {
39
+ await fs.rm(dirpath, { recursive: true, force: true });
40
+ }
41
+ async function loadJson(filepath) {
42
+ const content = await fs.readFile(filepath, "utf-8");
43
+ return JSON.parse(content);
44
+ }
45
+ async function isDirectory(dirpath) {
46
+ return fs.stat(dirpath).then((fsStat) => {
47
+ return fsStat.isDirectory();
48
+ }).catch((err) => {
49
+ if (err.code === "ENOENT") {
50
+ return false;
51
+ }
52
+ throw err;
53
+ });
54
+ }
55
+ function fileExists(filepath) {
56
+ return fs.access(filepath).then(() => true).catch(() => false);
57
+ }
58
+ async function directoryContains(dirpath, subpath) {
59
+ const outer = await fs.realpath(dirpath);
60
+ const inner = await fs.realpath(subpath);
61
+ const rel = path.relative(outer, inner);
62
+ return !rel.startsWith("..");
63
+ }
64
+
65
+ // src/node/load-config.ts
66
+ async function loadRootConfig(rootDir, options) {
67
+ const configPath = path2.resolve(rootDir, "root.config.ts");
68
+ const exists = await fileExists(configPath);
69
+ if (!exists) {
70
+ throw new Error(`${configPath} does not exist`);
71
+ }
72
+ const configBundle = await bundleRequire({
73
+ filepath: configPath
74
+ });
75
+ let config = configBundle.mod.default || {};
76
+ if (typeof config === "function") {
77
+ config = await config(options) || {};
78
+ }
79
+ return Object.assign({}, config, { rootDir });
80
+ }
81
+
82
+ // src/node/vite.ts
83
+ import path3 from "node:path";
84
+ import { createServer } from "vite";
85
+ async function createViteServer(rootConfig, options) {
86
+ var _a, _b;
87
+ const rootDir = rootConfig.rootDir;
88
+ const viteConfig = rootConfig.vite || {};
89
+ let hmrOptions = (_a = viteConfig.server) == null ? void 0 : _a.hmr;
90
+ if ((options == null ? void 0 : options.hmr) === false) {
91
+ hmrOptions = false;
92
+ } else if (typeof hmrOptions === "undefined" && (options == null ? void 0 : options.port)) {
93
+ hmrOptions = { port: options.port + 10 };
94
+ }
95
+ const viteServer = await createServer({
96
+ ...viteConfig,
97
+ mode: "development",
98
+ root: rootDir,
99
+ publicDir: path3.join(rootDir, "public"),
100
+ server: {
101
+ ...viteConfig.server || {},
102
+ middlewareMode: true,
103
+ hmr: hmrOptions
104
+ },
105
+ appType: "custom",
106
+ optimizeDeps: {
107
+ ...viteConfig.optimizeDeps || {},
108
+ include: [
109
+ ...(options == null ? void 0 : options.optimizeDeps) || [],
110
+ ...((_b = viteConfig.optimizeDeps) == null ? void 0 : _b.include) || []
111
+ ]
112
+ },
113
+ ssr: {
114
+ ...viteConfig.ssr || {},
115
+ noExternal: ["@blinkk/root"]
116
+ },
117
+ esbuild: {
118
+ ...viteConfig.esbuild || {},
119
+ jsx: "automatic",
120
+ jsxImportSource: "preact"
121
+ },
122
+ plugins: [
123
+ ...viteConfig.plugins || [],
124
+ ...getVitePlugins(rootConfig.plugins || [])
125
+ ]
126
+ });
127
+ return viteServer;
128
+ }
129
+ async function viteSsrLoadModule(rootConfig, file) {
130
+ const viteServer = await createViteServer(rootConfig, { hmr: false });
131
+ const module = await viteServer.ssrLoadModule(file);
132
+ await viteServer.close();
133
+ return module;
134
+ }
135
+
136
+ export {
137
+ isJsFile,
138
+ writeFile,
139
+ makeDir,
140
+ copyGlob,
141
+ rmDir,
142
+ loadJson,
143
+ isDirectory,
144
+ fileExists,
145
+ directoryContains,
146
+ loadRootConfig,
147
+ createViteServer,
148
+ viteSsrLoadModule
149
+ };
150
+ //# sourceMappingURL=chunk-LTSJAEBG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/node/load-config.ts","../src/utils/fsutils.ts","../src/node/vite.ts"],"sourcesContent":["import path from 'node:path';\nimport {bundleRequire} from 'bundle-require';\nimport {RootConfig} from '../core/config';\nimport {fileExists} from '../utils/fsutils';\n\nexport interface ConfigOptions {\n command: string;\n}\n\nexport async function loadRootConfig(\n rootDir: string,\n options: ConfigOptions\n): Promise<RootConfig> {\n const configPath = path.resolve(rootDir, 'root.config.ts');\n const exists = await fileExists(configPath);\n if (!exists) {\n throw new Error(`${configPath} does not exist`);\n }\n const configBundle = await bundleRequire({\n filepath: configPath,\n });\n let config = configBundle.mod.default || {};\n if (typeof config === 'function') {\n config = (await config(options)) || {};\n }\n return Object.assign({}, config, {rootDir});\n}\n","import {promises as fs} from 'node:fs';\nimport path from 'node:path';\nimport fsExtra from 'fs-extra';\nimport glob from 'tiny-glob';\n\nexport function isJsFile(filename: string) {\n return !!filename.match(/\\.(j|t)sx?$/);\n}\n\nexport async function writeFile(filepath: string, content: string) {\n const dirPath = path.dirname(filepath);\n await makeDir(dirPath);\n await fs.writeFile(filepath, content);\n}\n\nexport async function makeDir(dirpath: string) {\n try {\n await fs.access(dirpath);\n } catch (e) {\n await fs.mkdir(dirpath, {recursive: true});\n }\n}\n\nexport async function copyDir(srcdir: string, dstdir: string) {\n if (!fsExtra.existsSync(srcdir)) {\n return;\n }\n fsExtra.copySync(srcdir, dstdir, {recursive: true, overwrite: true});\n}\n\n/**\n * Copies a glob of files from one directory to another.\n *\n * Example:\n *\n * ```\n * await copyGlob('*.css', 'src/styles', 'dist/html/styles');\n * ```\n */\nexport async function copyGlob(\n pattern: string,\n srcdir: string,\n dstdir: string\n) {\n const files = await glob(pattern, {cwd: srcdir});\n if (files.length > 0) {\n await makeDir(dstdir);\n }\n files.forEach((file) => {\n fsExtra.copySync(path.resolve(srcdir, file), path.resolve(dstdir, file));\n });\n}\n\nexport async function rmDir(dirpath: string) {\n await fs.rm(dirpath, {recursive: true, force: true});\n}\n\nexport async function loadJson<T = unknown>(filepath: string): Promise<T> {\n const content = await fs.readFile(filepath, 'utf-8');\n return JSON.parse(content);\n}\n\nexport async function isDirectory(dirpath: string) {\n return fs\n .stat(dirpath)\n .then((fsStat) => {\n return fsStat.isDirectory();\n })\n .catch((err) => {\n if (err.code === 'ENOENT') {\n return false;\n }\n throw err;\n });\n}\n\nexport function fileExists(filepath: string): Promise<boolean> {\n return fs\n .access(filepath)\n .then(() => true)\n .catch(() => false);\n}\n\nexport async function directoryContains(\n dirpath: string,\n subpath: string\n): Promise<boolean> {\n const outer = await fs.realpath(dirpath);\n const inner = await fs.realpath(subpath);\n const rel = path.relative(outer, inner);\n return !rel.startsWith('..');\n}\n","import path from 'node:path';\nimport {createServer, ViteDevServer} from 'vite';\nimport {getVitePlugins} from '../core/plugin.js';\nimport {RootConfig} from '../core/config.js';\n\nexport interface CreateViteServerOptions {\n /** Override HMR settings. */\n hmr?: boolean;\n /** The port the server will run on. */\n port?: number;\n /** List of files to include in the optimizeDeps.include config. */\n optimizeDeps?: string[];\n}\n\n/**\n * Returns a vite dev server.\n */\nexport async function createViteServer(\n rootConfig: RootConfig,\n options?: CreateViteServerOptions\n): Promise<ViteDevServer> {\n const rootDir = rootConfig.rootDir;\n const viteConfig = rootConfig.vite || {};\n\n let hmrOptions = viteConfig.server?.hmr;\n if (options?.hmr === false) {\n hmrOptions = false;\n } else if (typeof hmrOptions === 'undefined' && options?.port) {\n // Automatically set the HMR port to `port + 10`. This allows multiple\n // root.js dev servers to run without conflicts.\n hmrOptions = {port: options.port + 10};\n }\n\n const viteServer = await createServer({\n ...viteConfig,\n mode: 'development',\n root: rootDir,\n publicDir: path.join(rootDir, 'public'),\n server: {\n ...(viteConfig.server || {}),\n middlewareMode: true,\n hmr: hmrOptions,\n },\n appType: 'custom',\n optimizeDeps: {\n ...(viteConfig.optimizeDeps || {}),\n include: [\n ...(options?.optimizeDeps || []),\n ...(viteConfig.optimizeDeps?.include || []),\n ],\n },\n ssr: {\n ...(viteConfig.ssr || {}),\n noExternal: ['@blinkk/root'],\n },\n esbuild: {\n ...(viteConfig.esbuild || {}),\n jsx: 'automatic',\n jsxImportSource: 'preact',\n },\n plugins: [\n ...(viteConfig.plugins || []),\n ...getVitePlugins(rootConfig.plugins || []),\n ],\n });\n return viteServer;\n}\n\n/**\n * Shortcut `viteServer.ssrLoadModule()` without starting an actual dev server.\n */\nexport async function viteSsrLoadModule(\n rootConfig: RootConfig,\n file: string\n): Promise<Record<string, any>> {\n const viteServer = await createViteServer(rootCon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AAAA,IACpC,GAAG;AAAA,IACH,MAAM;AAAA,IACN,MAAM;AAAA,IACN,WAAWC,MAAK,KAAK,SAAS,QAAQ;AAAA,IACtC,QAAQ;AAAA,MACN,GAAI,WAAW,UAAU,CAAC;AAAA,MAC1B,gBAAgB;AAAA,MAChB,KAAK;AAAA,IACP;AAAA,IACA,SAAS;AAAA,IACT,cAAc;AAAA,MACZ,GAAI,WAAW,gBAAgB,CAAC;AAAA,MAChC,SAAS;AAAA,QACP,IAAI,mCAAS,iBAAgB,CAAC;AAAA,QAC9B,KAAI,gBAAW,iBAAX,mBAAyB,YAAW,CAAC;AAAA,MAC3C;AAAA,IACF;AAAA,IACA,KAAK;AAAA,MACH,GAAI,WAAW,OAAO,CAAC;AAAA,MACvB,YAAY,CAAC,cAAc;AAAA,IAC7B;AAAA,IACA,SAAS;AAAA,MACP,GAAI,WAAW,WAAW,CAAC;AAAA,MAC3B,KAAK;AAAA,MACL,iBAAiB;AAAA,IACnB;AAAA,IACA,SAAS;AAAA,MACP,GAAI,WAAW,WAAW,CAAC;AAAA,MAC3B,GAAG,eAAe,WAAW,WAAW,CAAC,CAAC;AAAA,IAC5C;AAAA,EACF,CAAC;AACD,SAAO;AACT;AAKA,eAAsB,kBACpB,YACA,MAC8B;AAC9B,QAAM,aAAa,MAAM,iBAAiB,YAAY,EAAC,KAAK,MAAK,CAAC;AAClE,QAAM,SAAS,MAAM,WAAW,cAAc,IAAI;AAClD,QAAM,WAAW,MAAM;AACvB,SAAO;AACT;","names":["path","path","path","path"]}
@@ -1,19 +1,3 @@
1
- // src/utils/elements.ts
2
- var ELEMENT_RE = /^[a-z][\w-]*-[\w-]*$/;
3
- var HTML_ELEMENTS_REGEX = /<([a-z][\w-]*-[\w-]*)/g;
4
- function isValidTagName(tagName) {
5
- return ELEMENT_RE.test(tagName);
6
- }
7
- function parseTagNames(src) {
8
- const tagNames = /* @__PURE__ */ new Set();
9
- const matches = Array.from(src.matchAll(HTML_ELEMENTS_REGEX));
10
- for (const match of matches) {
11
- const tagName = match[1];
12
- tagNames.add(tagName);
13
- }
14
- return Array.from(tagNames);
15
- }
16
-
17
1
  // src/render/html-minify.ts
18
2
  import { createRequire } from "module";
19
3
  var require2 = createRequire(import.meta.url);
@@ -33,6 +17,22 @@ async function htmlMinify(html, options) {
33
17
  }
34
18
  }
35
19
 
20
+ // src/utils/elements.ts
21
+ var ELEMENT_RE = /^[a-z][\w-]*-[\w-]*$/;
22
+ var HTML_ELEMENTS_REGEX = /<([a-z][\w-]*-[\w-]*)/g;
23
+ function isValidTagName(tagName) {
24
+ return ELEMENT_RE.test(tagName);
25
+ }
26
+ function parseTagNames(src) {
27
+ const tagNames = /* @__PURE__ */ new Set();
28
+ const matches = Array.from(src.matchAll(HTML_ELEMENTS_REGEX));
29
+ for (const match of matches) {
30
+ const tagName = match[1];
31
+ tagNames.add(tagName);
32
+ }
33
+ return Array.from(tagNames);
34
+ }
35
+
36
36
  // src/render/html-pretty.ts
37
37
  import { createRequire as createRequire2 } from "module";
38
38
  var require3 = createRequire2(import.meta.url);
@@ -53,9 +53,9 @@ async function htmlPretty(html, options) {
53
53
  }
54
54
 
55
55
  export {
56
+ htmlMinify,
56
57
  isValidTagName,
57
58
  parseTagNames,
58
- htmlMinify,
59
59
  htmlPretty
60
60
  };
61
- //# sourceMappingURL=chunk-GGQGZ7ZE.js.map
61
+ //# sourceMappingURL=chunk-WVRC46JG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/render/html-minify.ts","../src/utils/elements.ts","../src/render/html-pretty.ts"],"sourcesContent":["import {createRequire} from 'module';\nconst require = createRequire(import.meta.url);\nconst {minify} = require('html-minifier-terser');\nimport type {Options} from 'html-minifier-terser';\n\nexport type HtmlMinifyOptions = Options;\n\nexport async function htmlMinify(\n html: string,\n options?: HtmlMinifyOptions\n): Promise<string> {\n const minifyOptions = options || {\n collapseWhitespace: true,\n removeComments: true,\n preserveLineBreaks: true,\n };\n try {\n const min = await minify(html, minifyOptions);\n return min.trimStart();\n } catch (e) {\n console.error('failed to minify html:', e);\n return html;\n }\n}\n","export const ELEMENT_RE = /^[a-z][\\w-]*-[\\w-]*$/;\nexport const HTML_ELEMENTS_REGEX = /<([a-z][\\w-]*-[\\w-]*)/g;\n\n/**\n * Returns true if the tagName is a valid custom element tag.\n */\nexport function isValidTagName(tagName: string) {\n return ELEMENT_RE.test(tagName);\n}\n\n/**\n * Returns a list of custom elements used in a src string (e.g. HTML, jsx, lit).\n * NOTE: the impl uses a simple regex, so tagNames used in comments and attr\n * values may be included.\n */\nexport function parseTagNames(src: string): string[] {\n const tagNames = new Set<string>();\n const matches = Array.from(src.matchAll(HTML_ELEMENTS_REGEX));\n for (const match of matches) {\n const tagName = match[1];\n tagNames.add(tagName);\n }\n return Array.from(tagNames);\n}\n","import {createRequire} from 'module';\nconst require = createRequire(import.meta.url);\nconst beautify = require('js-beautify');\nimport type {HTMLBeautifyOptions} from 'js-beautify';\n\nexport type HtmlPrettyOptions = HTMLBeautifyOptions;\n\nexport async function htmlPretty(\n html: string,\n options?: HtmlPrettyOptions\n): Promise<string> {\n const prettyOptions = options || {\n indent_size: 0,\n end_with_newline: true,\n extra_liners: [],\n };\n try {\n const output = beautify.html(html, prettyOptions);\n return output.trimStart();\n } catch (e) {\n console.error('failed to pretty html:', e);\n return html;\n }\n}\n"],"mappings":";AAAA,SAAQ,qBAAoB;AAC5B,IAAMA,WAAU,cAAc,YAAY,GAAG;AAC7C,IAAM,EAAC,OAAM,IAAIA,SAAQ,sBAAsB;AAK/C,eAAsB,WACpB,MACA,SACiB;AACjB,QAAM,gBAAgB,WAAW;AAAA,IAC/B,oBAAoB;AAAA,IACpB,gBAAgB;AAAA,IAChB,oBAAoB;AAAA,EACtB;AACA,MAAI;AACF,UAAM,MAAM,MAAM,OAAO,MAAM,aAAa;AAC5C,WAAO,IAAI,UAAU;AAAA,EACvB,SAAS,GAAP;AACA,YAAQ,MAAM,0BAA0B,CAAC;AACzC,WAAO;AAAA,EACT;AACF;;;ACvBO,IAAM,aAAa;AACnB,IAAM,sBAAsB;AAK5B,SAAS,eAAe,SAAiB;AAC9C,SAAO,WAAW,KAAK,OAAO;AAChC;AAOO,SAAS,cAAc,KAAuB;AACnD,QAAM,WAAW,oBAAI,IAAY;AACjC,QAAM,UAAU,MAAM,KAAK,IAAI,SAAS,mBAAmB,CAAC;AAC5D,aAAW,SAAS,SAAS;AAC3B,UAAM,UAAU,MAAM;AACtB,aAAS,IAAI,OAAO;AAAA,EACtB;AACA,SAAO,MAAM,KAAK,QAAQ;AAC5B;;;ACvBA,SAAQ,iBAAAC,sBAAoB;AAC5B,IAAMC,WAAUD,eAAc,YAAY,GAAG;AAC7C,IAAM,WAAWC,SAAQ,aAAa;AAKtC,eAAsB,WACpB,MACA,SACiB;AACjB,QAAM,gBAAgB,WAAW;AAAA,IAC/B,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,cAAc,CAAC;AAAA,EACjB;AACA,MAAI;AACF,UAAM,SAAS,SAAS,KAAK,MAAM,aAAa;AAChD,WAAO,OAAO,UAAU;AAAA,EAC1B,SAAS,GAAP;AACA,YAAQ,MAAM,0BAA0B,CAAC;AACzC,WAAO;AAAA,EACT;AACF;","names":["require","createRequire","require"]}
package/dist/cli.d.ts CHANGED
@@ -1,4 +1,9 @@
1
- declare function dev(rootProjectDir?: string): Promise<void>;
1
+ import { S as Server } from './types-8310f09f.js';
2
+ import 'express';
3
+ import 'preact';
4
+ import 'vite';
5
+ import 'html-minifier-terser';
6
+ import 'js-beautify';
2
7
 
3
8
  interface BuildOptions {
4
9
  ssrOnly?: boolean;
@@ -6,8 +11,29 @@ interface BuildOptions {
6
11
  }
7
12
  declare function build(rootProjectDir?: string, options?: BuildOptions): Promise<void>;
8
13
 
9
- declare function preview(rootProjectDir?: string): Promise<void>;
14
+ interface DevOptions {
15
+ host?: string;
16
+ }
17
+ declare function dev(rootProjectDir?: string, options?: DevOptions): Promise<void>;
18
+ declare function createDevServer(options?: {
19
+ rootDir?: string;
20
+ port?: number;
21
+ }): Promise<Server>;
22
+
23
+ interface PreviewOptions {
24
+ host?: string;
25
+ }
26
+ declare function preview(rootProjectDir?: string, options?: PreviewOptions): Promise<void>;
27
+ declare function createPreviewServer(options: {
28
+ rootDir: string;
29
+ }): Promise<Server>;
10
30
 
11
- declare function start(rootProjectDir?: string): Promise<void>;
31
+ interface StartOptions {
32
+ host?: string;
33
+ }
34
+ declare function start(rootProjectDir?: string, options?: StartOptions): Promise<void>;
35
+ declare function createProdServer(options: {
36
+ rootDir: string;
37
+ }): Promise<Server>;
12
38
 
13
- export { build, dev, preview, start };
39
+ export { build, createDevServer, createPreviewServer, createProdServer, dev, preview, start };