@blinkk/root 1.0.0-beta.2 → 1.0.0-beta.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.
@@ -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-47b9b530.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,20 @@ interface BuildOptions {
6
11
  }
7
12
  declare function build(rootProjectDir?: string, options?: BuildOptions): Promise<void>;
8
13
 
14
+ declare function dev(rootProjectDir?: string): Promise<void>;
15
+ declare function createDevServer(options?: {
16
+ rootDir?: string;
17
+ port?: number;
18
+ }): Promise<Server>;
19
+
9
20
  declare function preview(rootProjectDir?: string): Promise<void>;
21
+ declare function createPreviewServer(options: {
22
+ rootDir: string;
23
+ }): Promise<Server>;
10
24
 
11
25
  declare function start(rootProjectDir?: string): Promise<void>;
26
+ declare function createProdServer(options: {
27
+ rootDir: string;
28
+ }): Promise<Server>;
12
29
 
13
- export { build, dev, preview, start };
30
+ export { build, createDevServer, createPreviewServer, createProdServer, dev, preview, start };