@blinkk/root 1.0.0-beta.17 → 1.0.0-beta.18

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 +0,0 @@
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"]}
@@ -4,31 +4,9 @@ import { PluginOption, UserConfig, ViteDevServer } from 'vite';
4
4
  import { Options } from 'html-minifier-terser';
5
5
  import { HTMLBeautifyOptions } from 'js-beautify';
6
6
 
7
- interface Asset {
8
- /**
9
- * The path to the asset's src file, relative to the project root.
10
- */
11
- src: string;
12
- /**
13
- * The serving URL for the asset.
14
- */
15
- assetUrl: string;
16
- /**
17
- * Recursively walks all deps and returns a list of CSS asset URLs.
18
- */
19
- getCssDeps(): Promise<string[]>;
20
- /**
21
- * Recursively walks all deps and returns a list of JS asset URLs.
22
- */
23
- getJsDeps(): Promise<string[]>;
24
- }
25
- interface AssetMap {
26
- /**
27
- * Returns the asset for a given src file. The `src` value should be a path
28
- * relative to the project root, e.g. "routes/index.tsx".
29
- */
30
- get: (src: string) => Promise<Asset | null>;
31
- }
7
+ declare type HtmlMinifyOptions = Options;
8
+
9
+ declare type HtmlPrettyOptions = HTMLBeautifyOptions;
32
10
 
33
11
  declare type MaybePromise<T> = T | Promise<T>;
34
12
  declare type ConfigureServerHook = (server: Server, options: ConfigureServerOptions) => MaybePromise<void> | MaybePromise<() => void>;
@@ -70,10 +48,6 @@ interface Plugin {
70
48
  declare function configureServerPlugins(server: Server, callback: () => Promise<void>, plugins: Plugin[], options: ConfigureServerOptions): Promise<void>;
71
49
  declare function getVitePlugins(plugins: Plugin[]): PluginOption[];
72
50
 
73
- declare type HtmlMinifyOptions = Options;
74
-
75
- declare type HtmlPrettyOptions = HTMLBeautifyOptions;
76
-
77
51
  interface RootUserConfig {
78
52
  /**
79
53
  * Canonical domain the website will serve on. Useful for things like the
@@ -201,6 +175,32 @@ declare class ElementGraph {
201
175
  private parseDepsFromSource;
202
176
  }
203
177
 
178
+ interface Asset {
179
+ /**
180
+ * The path to the asset's src file, relative to the project root.
181
+ */
182
+ src: string;
183
+ /**
184
+ * The serving URL for the asset.
185
+ */
186
+ assetUrl: string;
187
+ /**
188
+ * Recursively walks all deps and returns a list of CSS asset URLs.
189
+ */
190
+ getCssDeps(): Promise<string[]>;
191
+ /**
192
+ * Recursively walks all deps and returns a list of JS asset URLs.
193
+ */
194
+ getJsDeps(): Promise<string[]>;
195
+ }
196
+ interface AssetMap {
197
+ /**
198
+ * Returns the asset for a given src file. The `src` value should be a path
199
+ * relative to the project root, e.g. "routes/index.tsx".
200
+ */
201
+ get: (src: string) => Promise<Asset | null>;
202
+ }
203
+
204
204
  declare class Renderer {
205
205
  private rootConfig;
206
206
  private routes;