@hedystia/astro 2.3.18 → 2.3.19
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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ function src_default(options = {}) {
|
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
function injectCSSIntoHTML(dir, css) {
|
|
41
|
-
const styleTag = `<style data-hedystia-css
|
|
41
|
+
const styleTag = `<style data-hedystia-css>${css}</style>`;
|
|
42
42
|
for (const file of findHTMLFiles(dir)) {
|
|
43
43
|
let content = node_fs.default.readFileSync(file, "utf-8");
|
|
44
44
|
if (content.includes("data-hedystia-css")) continue;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["fs","path"],"sources":["../src/index.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { viewPlugin } from \"@hedystia/view/vite\";\nimport type { AstroIntegration, AstroRenderer } from \"astro\";\nimport type { Plugin, UserConfig } from \"vite\";\n\nfunction getRenderer(): AstroRenderer {\n return {\n name: \"@hedystia/astro\",\n clientEntrypoint: \"@hedystia/astro/client.js\",\n serverEntrypoint: \"@hedystia/astro/server.js\",\n };\n}\n\nexport { getRenderer as getContainerRenderer };\n\nexport interface Options {\n include?: string[];\n exclude?: string[];\n}\n\nexport default function (options: Options = {}): AstroIntegration {\n const { plugins, collectedCSS } = viewPlugin(options);\n\n return {\n name: \"@hedystia/astro\",\n hooks: {\n \"astro:config:setup\": async ({ addRenderer, updateConfig }) => {\n addRenderer(getRenderer());\n updateConfig({\n vite: {\n plugins: [...plugins, configEnvironmentPlugin()],\n ssr: {\n noExternal: [\"@hedystia/view\"],\n },\n },\n });\n },\n \"astro:build:done\": async ({ dir }) => {\n if (collectedCSS.size > 0) {\n const css = Array.from(collectedCSS.values()).join(\"\\n\");\n injectCSSIntoHTML(dir.pathname, css);\n }\n },\n },\n };\n}\n\nfunction injectCSSIntoHTML(dir: string, css: string): void {\n const styleTag = `<style data-hedystia-css
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["fs","path"],"sources":["../src/index.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { viewPlugin } from \"@hedystia/view/vite\";\nimport type { AstroIntegration, AstroRenderer } from \"astro\";\nimport type { Plugin, UserConfig } from \"vite\";\n\nfunction getRenderer(): AstroRenderer {\n return {\n name: \"@hedystia/astro\",\n clientEntrypoint: \"@hedystia/astro/client.js\",\n serverEntrypoint: \"@hedystia/astro/server.js\",\n };\n}\n\nexport { getRenderer as getContainerRenderer };\n\nexport interface Options {\n include?: string[];\n exclude?: string[];\n}\n\nexport default function (options: Options = {}): AstroIntegration {\n const { plugins, collectedCSS } = viewPlugin(options);\n\n return {\n name: \"@hedystia/astro\",\n hooks: {\n \"astro:config:setup\": async ({ addRenderer, updateConfig }) => {\n addRenderer(getRenderer());\n updateConfig({\n vite: {\n plugins: [...plugins, configEnvironmentPlugin()],\n ssr: {\n noExternal: [\"@hedystia/view\"],\n },\n },\n });\n },\n \"astro:build:done\": async ({ dir }) => {\n if (collectedCSS.size > 0) {\n const css = Array.from(collectedCSS.values()).join(\"\\n\");\n injectCSSIntoHTML(dir.pathname, css);\n }\n },\n },\n };\n}\n\nfunction injectCSSIntoHTML(dir: string, css: string): void {\n const styleTag = `<style data-hedystia-css>${css}</style>`;\n\n for (const file of findHTMLFiles(dir)) {\n let content = fs.readFileSync(file, \"utf-8\");\n if (content.includes(\"data-hedystia-css\")) {\n continue;\n }\n if (content.includes(\"</head>\")) {\n content = content.replace(\"</head>\", `${styleTag}</head>`);\n } else {\n content = `${styleTag}${content}`;\n }\n fs.writeFileSync(file, content, \"utf-8\");\n }\n}\n\nfunction findHTMLFiles(dir: string): string[] {\n const files: string[] = [];\n const walk = (d: string) => {\n for (const entry of fs.readdirSync(d, { withFileTypes: true })) {\n const full = path.join(d, entry.name);\n if (entry.isDirectory()) {\n walk(full);\n } else if (entry.name.endsWith(\".html\")) {\n files.push(full);\n }\n }\n };\n walk(dir);\n return files;\n}\n\nfunction configEnvironmentPlugin(): Plugin {\n return {\n name: \"@hedystia/astro:config-environment\",\n configEnvironment(environmentName: string): UserConfig | Promise<UserConfig> | undefined {\n return {\n optimizeDeps: {\n include: environmentName === \"client\" ? [\"@hedystia/astro/client.js\"] : [],\n exclude: [\"@hedystia/astro/server.js\"],\n },\n };\n },\n };\n}\n"],"mappings":";;;;;;;;;;;AAMA,SAAS,cAA6B;CACpC,OAAO;EACL,MAAM;EACN,kBAAkB;EAClB,kBAAkB;CACpB;AACF;AASA,SAAA,YAAyB,UAAmB,CAAC,GAAqB;CAChE,MAAM,EAAE,SAAS,kBAAA,GAAA,oBAAA,YAA4B,OAAO;CAEpD,OAAO;EACL,MAAM;EACN,OAAO;GACL,sBAAsB,OAAO,EAAE,aAAa,mBAAmB;IAC7D,YAAY,YAAY,CAAC;IACzB,aAAa,EACX,MAAM;KACJ,SAAS,CAAC,GAAG,SAAS,wBAAwB,CAAC;KAC/C,KAAK,EACH,YAAY,CAAC,gBAAgB,EAC/B;IACF,EACF,CAAC;GACH;GACA,oBAAoB,OAAO,EAAE,UAAU;IACrC,IAAI,aAAa,OAAO,GAAG;KACzB,MAAM,MAAM,MAAM,KAAK,aAAa,OAAO,CAAC,EAAE,KAAK,IAAI;KACvD,kBAAkB,IAAI,UAAU,GAAG;IACrC;GACF;EACF;CACF;AACF;AAEA,SAAS,kBAAkB,KAAa,KAAmB;CACzD,MAAM,WAAW,4BAA4B,IAAI;CAEjD,KAAK,MAAM,QAAQ,cAAc,GAAG,GAAG;EACrC,IAAI,UAAUA,QAAAA,QAAG,aAAa,MAAM,OAAO;EAC3C,IAAI,QAAQ,SAAS,mBAAmB,GACtC;EAEF,IAAI,QAAQ,SAAS,SAAS,GAC5B,UAAU,QAAQ,QAAQ,WAAW,GAAG,SAAS,QAAQ;OAEzD,UAAU,GAAG,WAAW;EAE1B,QAAA,QAAG,cAAc,MAAM,SAAS,OAAO;CACzC;AACF;AAEA,SAAS,cAAc,KAAuB;CAC5C,MAAM,QAAkB,CAAC;CACzB,MAAM,QAAQ,MAAc;EAC1B,KAAK,MAAM,SAASA,QAAAA,QAAG,YAAY,GAAG,EAAE,eAAe,KAAK,CAAC,GAAG;GAC9D,MAAM,OAAOC,UAAAA,QAAK,KAAK,GAAG,MAAM,IAAI;GACpC,IAAI,MAAM,YAAY,GACpB,KAAK,IAAI;QACJ,IAAI,MAAM,KAAK,SAAS,OAAO,GACpC,MAAM,KAAK,IAAI;EAEnB;CACF;CACA,KAAK,GAAG;CACR,OAAO;AACT;AAEA,SAAS,0BAAkC;CACzC,OAAO;EACL,MAAM;EACN,kBAAkB,iBAAuE;GACvF,OAAO,EACL,cAAc;IACZ,SAAS,oBAAoB,WAAW,CAAC,2BAA2B,IAAI,CAAC;IACzE,SAAS,CAAC,2BAA2B;GACvC,EACF;EACF;CACF;AACF"}
|
package/dist/index.mjs
CHANGED
|
@@ -31,7 +31,7 @@ function src_default(options = {}) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
function injectCSSIntoHTML(dir, css) {
|
|
34
|
-
const styleTag = `<style data-hedystia-css
|
|
34
|
+
const styleTag = `<style data-hedystia-css>${css}</style>`;
|
|
35
35
|
for (const file of findHTMLFiles(dir)) {
|
|
36
36
|
let content = fs.readFileSync(file, "utf-8");
|
|
37
37
|
if (content.includes("data-hedystia-css")) continue;
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { viewPlugin } from \"@hedystia/view/vite\";\nimport type { AstroIntegration, AstroRenderer } from \"astro\";\nimport type { Plugin, UserConfig } from \"vite\";\n\nfunction getRenderer(): AstroRenderer {\n return {\n name: \"@hedystia/astro\",\n clientEntrypoint: \"@hedystia/astro/client.js\",\n serverEntrypoint: \"@hedystia/astro/server.js\",\n };\n}\n\nexport { getRenderer as getContainerRenderer };\n\nexport interface Options {\n include?: string[];\n exclude?: string[];\n}\n\nexport default function (options: Options = {}): AstroIntegration {\n const { plugins, collectedCSS } = viewPlugin(options);\n\n return {\n name: \"@hedystia/astro\",\n hooks: {\n \"astro:config:setup\": async ({ addRenderer, updateConfig }) => {\n addRenderer(getRenderer());\n updateConfig({\n vite: {\n plugins: [...plugins, configEnvironmentPlugin()],\n ssr: {\n noExternal: [\"@hedystia/view\"],\n },\n },\n });\n },\n \"astro:build:done\": async ({ dir }) => {\n if (collectedCSS.size > 0) {\n const css = Array.from(collectedCSS.values()).join(\"\\n\");\n injectCSSIntoHTML(dir.pathname, css);\n }\n },\n },\n };\n}\n\nfunction injectCSSIntoHTML(dir: string, css: string): void {\n const styleTag = `<style data-hedystia-css
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { viewPlugin } from \"@hedystia/view/vite\";\nimport type { AstroIntegration, AstroRenderer } from \"astro\";\nimport type { Plugin, UserConfig } from \"vite\";\n\nfunction getRenderer(): AstroRenderer {\n return {\n name: \"@hedystia/astro\",\n clientEntrypoint: \"@hedystia/astro/client.js\",\n serverEntrypoint: \"@hedystia/astro/server.js\",\n };\n}\n\nexport { getRenderer as getContainerRenderer };\n\nexport interface Options {\n include?: string[];\n exclude?: string[];\n}\n\nexport default function (options: Options = {}): AstroIntegration {\n const { plugins, collectedCSS } = viewPlugin(options);\n\n return {\n name: \"@hedystia/astro\",\n hooks: {\n \"astro:config:setup\": async ({ addRenderer, updateConfig }) => {\n addRenderer(getRenderer());\n updateConfig({\n vite: {\n plugins: [...plugins, configEnvironmentPlugin()],\n ssr: {\n noExternal: [\"@hedystia/view\"],\n },\n },\n });\n },\n \"astro:build:done\": async ({ dir }) => {\n if (collectedCSS.size > 0) {\n const css = Array.from(collectedCSS.values()).join(\"\\n\");\n injectCSSIntoHTML(dir.pathname, css);\n }\n },\n },\n };\n}\n\nfunction injectCSSIntoHTML(dir: string, css: string): void {\n const styleTag = `<style data-hedystia-css>${css}</style>`;\n\n for (const file of findHTMLFiles(dir)) {\n let content = fs.readFileSync(file, \"utf-8\");\n if (content.includes(\"data-hedystia-css\")) {\n continue;\n }\n if (content.includes(\"</head>\")) {\n content = content.replace(\"</head>\", `${styleTag}</head>`);\n } else {\n content = `${styleTag}${content}`;\n }\n fs.writeFileSync(file, content, \"utf-8\");\n }\n}\n\nfunction findHTMLFiles(dir: string): string[] {\n const files: string[] = [];\n const walk = (d: string) => {\n for (const entry of fs.readdirSync(d, { withFileTypes: true })) {\n const full = path.join(d, entry.name);\n if (entry.isDirectory()) {\n walk(full);\n } else if (entry.name.endsWith(\".html\")) {\n files.push(full);\n }\n }\n };\n walk(dir);\n return files;\n}\n\nfunction configEnvironmentPlugin(): Plugin {\n return {\n name: \"@hedystia/astro:config-environment\",\n configEnvironment(environmentName: string): UserConfig | Promise<UserConfig> | undefined {\n return {\n optimizeDeps: {\n include: environmentName === \"client\" ? [\"@hedystia/astro/client.js\"] : [],\n exclude: [\"@hedystia/astro/server.js\"],\n },\n };\n },\n };\n}\n"],"mappings":";;;;AAMA,SAAS,cAA6B;CACpC,OAAO;EACL,MAAM;EACN,kBAAkB;EAClB,kBAAkB;CACpB;AACF;AASA,SAAA,YAAyB,UAAmB,CAAC,GAAqB;CAChE,MAAM,EAAE,SAAS,iBAAiB,WAAW,OAAO;CAEpD,OAAO;EACL,MAAM;EACN,OAAO;GACL,sBAAsB,OAAO,EAAE,aAAa,mBAAmB;IAC7D,YAAY,YAAY,CAAC;IACzB,aAAa,EACX,MAAM;KACJ,SAAS,CAAC,GAAG,SAAS,wBAAwB,CAAC;KAC/C,KAAK,EACH,YAAY,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