From bc69d0a57a6d277cea5f56161166605a64ef4883 Mon Sep 17 00:00:00 2001 From: DanSnow Date: Fri, 14 Jun 2024 19:47:25 +0800 Subject: [PATCH] fix: enforce to use server version decode in helper --- .changeset/cold-horses-check.md | 6 +++++ package.json | 17 +++++++------ packages/karbon-utils/package.json | 5 ++++ packages/karbon/src/normalize-helper.ts | 2 +- packages/playground/moon.yml | 4 +++ packages/playground/nuxt.config.ts | 3 +++ yarn.lock | 33 ++++++++++++------------- 7 files changed, 44 insertions(+), 26 deletions(-) create mode 100644 .changeset/cold-horses-check.md diff --git a/.changeset/cold-horses-check.md b/.changeset/cold-horses-check.md new file mode 100644 index 00000000..9059e5dd --- /dev/null +++ b/.changeset/cold-horses-check.md @@ -0,0 +1,6 @@ +--- +'@storipress/karbon-utils': patch +'@storipress/karbon': patch +--- + +fix: enforce to use server version decode in helper diff --git a/package.json b/package.json index 17c33347..23c9f987 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,14 @@ { "name": "@storipress/karbon-mono-repo", "private": true, - "resolutions": { - "@nuxt/kit": "3.7.3", - "@nuxt/schema": "3.7.3", - "nuxt": "3.7.3" - }, + "workspaces": [ + "packages/*" + ], "scripts": { "build": "moon run build", "test": "moon run test --", "test:coverage": "moon run test-coverage --" }, - "workspaces": [ - "packages/*" - ], "devDependencies": { "@antfu/eslint-config": "2.21.1", "@changesets/changelog-github": "0.5.0", @@ -31,5 +26,11 @@ "typescript": "5.4.5", "vitest": "1.6.0" }, + "resolutions": { + "@nuxt/kit": "3.7.3", + "@nuxt/schema": "3.7.3", + "giget": "1.1.3", + "nuxt": "3.7.3" + }, "packageManager": "yarn@4.3.0" } diff --git a/packages/karbon-utils/package.json b/packages/karbon-utils/package.json index f214f9da..3b88a397 100644 --- a/packages/karbon-utils/package.json +++ b/packages/karbon-utils/package.json @@ -9,6 +9,7 @@ "exports": { ".": { "browser": "./dist/client/index.browser.js", + "workerd": "./dist/server/index.js", "types": "./dist/server/index.d.ts", "import": "./dist/server/index.js" }, @@ -19,6 +20,10 @@ "./browser": { "types": "./dist/client/index.browser.d.ts", "import": "./dist/client/index.browser.js" + }, + "./server": { + "types": "./dist/server/index.d.ts", + "import": "./dist/server/index.js" } }, "files": [ diff --git a/packages/karbon/src/normalize-helper.ts b/packages/karbon/src/normalize-helper.ts index 8cd27f85..2f9633e5 100644 --- a/packages/karbon/src/normalize-helper.ts +++ b/packages/karbon/src/normalize-helper.ts @@ -1,4 +1,4 @@ -import { htmlFilter } from '@storipress/karbon-utils' +import { htmlFilter } from '@storipress/karbon-utils/server' export function useArticleFilter() { return htmlFilter diff --git a/packages/playground/moon.yml b/packages/playground/moon.yml index 31ddc5a4..00fc149a 100644 --- a/packages/playground/moon.yml +++ b/packages/playground/moon.yml @@ -19,6 +19,10 @@ tasks: deps: - karbon:build - custom-field:build + build-worker: + extends: build + env: + NITRO_PRESET: cloudflare-pages bundle: command: karbon platform: node diff --git a/packages/playground/nuxt.config.ts b/packages/playground/nuxt.config.ts index ebeab7e4..b75bf7f4 100644 --- a/packages/playground/nuxt.config.ts +++ b/packages/playground/nuxt.config.ts @@ -27,6 +27,9 @@ export default defineNuxtConfig({ build: { transpile: ['@storipress/vue-advertising'], }, + nitro: { + minify: false, + }, routeRules: { '/posts/*': { swr: true }, }, diff --git a/yarn.lock b/yarn.lock index 4923d24f..c05828c1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9667,21 +9667,20 @@ __metadata: languageName: node linkType: hard -"giget@npm:^1.1.3, giget@npm:^1.2.1": - version: 1.2.3 - resolution: "giget@npm:1.2.3" +"giget@npm:1.1.3": + version: 1.1.3 + resolution: "giget@npm:1.1.3" dependencies: - citty: "npm:^0.1.6" - consola: "npm:^3.2.3" - defu: "npm:^6.1.4" - node-fetch-native: "npm:^1.6.3" - nypm: "npm:^0.3.8" - ohash: "npm:^1.1.3" - pathe: "npm:^1.1.2" + colorette: "npm:^2.0.20" + defu: "npm:^6.1.2" + https-proxy-agent: "npm:^7.0.2" + mri: "npm:^1.2.0" + node-fetch-native: "npm:^1.4.0" + pathe: "npm:^1.1.1" tar: "npm:^6.2.0" bin: giget: dist/cli.mjs - checksum: 10/85bdcf380566fc9c4299f029acbe78a706f1825912c6cea39b675d08064399988f5de30d17238246f725183ac7504e7b9d3000c417f1df7ebb52ab26c7d3ab8c + checksum: 10/d46faa23d7ea747e8f854843d6b8f1be645f2a374af10a7590156ac5703b82cc3beec5fe723fc900099c8da7d810a7a2b0e0e3cd9db9ad58b453ce4b5090eb5f languageName: node linkType: hard @@ -10281,13 +10280,13 @@ __metadata: languageName: node linkType: hard -"https-proxy-agent@npm:^7.0.0": - version: 7.0.2 - resolution: "https-proxy-agent@npm:7.0.2" +"https-proxy-agent@npm:^7.0.0, https-proxy-agent@npm:^7.0.2": + version: 7.0.4 + resolution: "https-proxy-agent@npm:7.0.4" dependencies: agent-base: "npm:^7.0.2" debug: "npm:4" - checksum: 10/9ec844f78fd643608239c9c3f6819918631df5cd3e17d104cc507226a39b5d4adda9d790fc9fd63ac0d2bb8a761b2f9f60faa80584a9bf9d7f2e8c5ed0acd330 + checksum: 10/405fe582bba461bfe5c7e2f8d752b384036854488b828ae6df6a587c654299cbb2c50df38c4b6ab303502c3c5e029a793fbaac965d1e86ee0be03faceb554d63 languageName: node linkType: hard @@ -12657,7 +12656,7 @@ __metadata: languageName: node linkType: hard -"node-fetch-native@npm:^1.1.1, node-fetch-native@npm:^1.2.0, node-fetch-native@npm:^1.4.1, node-fetch-native@npm:^1.6.1, node-fetch-native@npm:^1.6.2, node-fetch-native@npm:^1.6.3, node-fetch-native@npm:^1.6.4": +"node-fetch-native@npm:^1.1.1, node-fetch-native@npm:^1.2.0, node-fetch-native@npm:^1.4.0, node-fetch-native@npm:^1.4.1, node-fetch-native@npm:^1.6.1, node-fetch-native@npm:^1.6.2, node-fetch-native@npm:^1.6.3, node-fetch-native@npm:^1.6.4": version: 1.6.4 resolution: "node-fetch-native@npm:1.6.4" checksum: 10/39c4c6d0c2a4bed1444943e1647ad0d79eb6638cf159bc37dffeafd22cffcf6a998e006aa1f3dd1d9d2258db7d78dee96b44bee4ba0bbaf0440ed348794f2543 @@ -13127,7 +13126,7 @@ __metadata: languageName: node linkType: hard -"nypm@npm:^0.3.3, nypm@npm:^0.3.8": +"nypm@npm:^0.3.3": version: 0.3.8 resolution: "nypm@npm:0.3.8" dependencies: