honox 0.1.32 → 0.1.34

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,4 +1,5 @@
1
1
  import { Fragment, jsx } from "hono/jsx/jsx-runtime";
2
+ import { ensureTrailngSlash } from "../utils/path.js";
2
3
  const Link = (options) => {
3
4
  let { href, prod, manifest, ...rest } = options;
4
5
  if (href) {
@@ -18,7 +19,13 @@ const Link = (options) => {
18
19
  const assetInManifest = manifest[href.replace(/^\//, "")];
19
20
  if (assetInManifest) {
20
21
  if (href.startsWith("/")) {
21
- return /* @__PURE__ */ jsx("link", { href: `/${assetInManifest.file}`, ...rest });
22
+ return /* @__PURE__ */ jsx(
23
+ "link",
24
+ {
25
+ href: `${ensureTrailngSlash(import.meta.env.BASE_URL)}${assetInManifest.file}`,
26
+ ...rest
27
+ }
28
+ );
22
29
  }
23
30
  return /* @__PURE__ */ jsx("link", { href: assetInManifest.file, ...rest });
24
31
  }
@@ -1,4 +1,5 @@
1
1
  import { Fragment, jsx } from "hono/jsx/jsx-runtime";
2
+ import { ensureTrailngSlash } from "../utils/path.js";
2
3
  import { HasIslands } from "./has-islands.js";
3
4
  const Script = (options) => {
4
5
  const src = options.src;
@@ -23,7 +24,7 @@ const Script = (options) => {
23
24
  {
24
25
  type: "module",
25
26
  async: !!options.async,
26
- src: `/${scriptInManifest.file}`,
27
+ src: `${ensureTrailngSlash(import.meta.env.BASE_URL)}${scriptInManifest.file}`,
27
28
  nonce: options.nonce
28
29
  }
29
30
  ) });
@@ -0,0 +1,3 @@
1
+ declare const ensureTrailngSlash: (path: string) => string;
2
+
3
+ export { ensureTrailngSlash };
@@ -0,0 +1,6 @@
1
+ const ensureTrailngSlash = (path) => {
2
+ return path.endsWith("/") ? path : path + "/";
3
+ };
4
+ export {
5
+ ensureTrailngSlash
6
+ };
@@ -1,6 +1,6 @@
1
1
  import { Plugin } from 'vite';
2
2
 
3
- declare const transformJsxTags: (contents: string, componentName: string) => string | undefined;
3
+ declare const transformJsxTags: (contents: string, componentName: string) => any;
4
4
  type IsIsland = (id: string) => boolean;
5
5
  type IslandComponentsOptions = {
6
6
  /**
@@ -64,6 +64,7 @@ const transformJsxTags = (contents, componentName) => {
64
64
  if (ast) {
65
65
  let isTransformed = false;
66
66
  traverse(ast, {
67
+ // @ts-expect-error path is not typed
67
68
  ExportNamedDeclaration(path2) {
68
69
  if (path2.node.declaration?.type === "FunctionDeclaration") {
69
70
  const name = path2.node.declaration.id?.name;
@@ -109,6 +110,7 @@ const transformJsxTags = (contents, componentName) => {
109
110
  specifier.local.name = wrappedFunctionId.name;
110
111
  }
111
112
  },
113
+ // @ts-expect-error path is not typed
112
114
  ExportDefaultDeclaration(path2) {
113
115
  const declarationType = path2.node.declaration.type;
114
116
  if (declarationType === "FunctionDeclaration" || declarationType === "FunctionExpression" || declarationType === "ArrowFunctionExpression" || declarationType === "Identifier") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "honox",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -130,21 +130,19 @@
130
130
  "@hono/eslint-config": "^1.0.2",
131
131
  "@mdx-js/rollup": "^3.0.0",
132
132
  "@playwright/test": "^1.42.0",
133
- "@types/babel__generator": "^7",
134
- "@types/babel__traverse": "^7",
135
133
  "@types/node": "^20.10.5",
136
134
  "eslint": "^9.10.0",
137
135
  "glob": "^10.3.10",
138
136
  "happy-dom": "^15.11.6",
139
137
  "hono": "4.4.13",
140
- "np": "7.7.0",
138
+ "np": "^10.2.0",
141
139
  "prettier": "^3.1.1",
142
140
  "publint": "^0.2.7",
143
141
  "tsup": "^8.1.0",
144
142
  "typescript": "^5.3.3",
145
- "vite": "^5.2.8",
146
- "vite-tsconfig-paths": "^5.0.1",
147
- "vitest": "^1.4.0"
143
+ "vite": "^5.4.12",
144
+ "vite-tsconfig-paths": "^5.1.4",
145
+ "vitest": "^3.0.3"
148
146
  },
149
147
  "engines": {
150
148
  "node": ">=18.14.1"