honox 0.1.28 → 0.1.30

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/README.md CHANGED
@@ -326,11 +326,9 @@ import { createRoute } from 'honox/factory'
326
326
  import { secureHeaders, NONCE } from 'hono/secure-headers'
327
327
 
328
328
  secureHeaders({
329
- contentSecurityPolicy: import.meta.env.PROD
330
- ? {
331
- scriptSrc: [NONCE],
332
- }
333
- : undefined,
329
+ contentSecurityPolicy: {
330
+ scriptSrc: [NONCE]
331
+ }
334
332
  })
335
333
  ```
336
334
 
@@ -1,5 +1,5 @@
1
1
  import { Fragment, jsx } from "hono/jsx/jsx-runtime";
2
- const Link = async (options) => {
2
+ const Link = (options) => {
3
3
  let { href, prod, manifest, ...rest } = options;
4
4
  if (href) {
5
5
  if (prod ?? import.meta.env.PROD) {
@@ -163,15 +163,22 @@ function islandComponents(options) {
163
163
  root = config.root;
164
164
  if (!reactApiImportSource) {
165
165
  const tsConfigPath = path.resolve(process.cwd(), "tsconfig.json");
166
+ const denoJsonPath = path.resolve(process.cwd(), "deno.json");
167
+ let tsConfigRaw;
166
168
  try {
167
- const tsConfigRaw = await fs.readFile(tsConfigPath, "utf8");
168
- const tsConfig = parseJsonc(tsConfigRaw);
169
- reactApiImportSource = tsConfig.compilerOptions?.jsxImportSource;
170
- if (reactApiImportSource === "hono/jsx/dom") {
171
- reactApiImportSource = "hono/jsx";
169
+ tsConfigRaw = await fs.readFile(denoJsonPath, "utf8");
170
+ } catch (error1) {
171
+ try {
172
+ tsConfigRaw = await fs.readFile(tsConfigPath, "utf8");
173
+ } catch (error2) {
174
+ console.warn("Cannot find neither tsconfig.json nor deno.json", error1, error2);
175
+ return;
172
176
  }
173
- } catch (error) {
174
- console.warn("Error reading tsconfig.json:", error);
177
+ }
178
+ const tsConfig = parseJsonc(tsConfigRaw);
179
+ reactApiImportSource = tsConfig?.compilerOptions?.jsxImportSource;
180
+ if (reactApiImportSource === "hono/jsx/dom") {
181
+ reactApiImportSource = "hono/jsx";
175
182
  }
176
183
  }
177
184
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "honox",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -113,7 +113,7 @@
113
113
  "@babel/parser": "7.25.6",
114
114
  "@babel/traverse": "7.25.6",
115
115
  "@babel/types": "7.25.6",
116
- "@hono/vite-dev-server": "0.16.0",
116
+ "@hono/vite-dev-server": "0.18.0",
117
117
  "jsonc-parser": "3.3.1",
118
118
  "precinct": "12.1.2"
119
119
  },