From 522d2879b47563662a1643afff70e8edd936c57b Mon Sep 17 00:00:00 2001 From: Thomas Stokes Date: Tue, 5 Aug 2025 17:07:38 +0800 Subject: [PATCH] swap amaro for stripTypeScriptTypes from node:module currently raises an experimental warning --- examples/ssr/main.ts | 4 ++-- examples/ssr/package.json | 2 +- pnpm-lock.yaml | 18 ------------------ scripts/test/browser-runtime.ts | 4 ++-- scripts/test/package.json | 1 - 5 files changed, 5 insertions(+), 24 deletions(-) diff --git a/examples/ssr/main.ts b/examples/ssr/main.ts index 4cd240aa..96858797 100644 --- a/examples/ssr/main.ts +++ b/examples/ssr/main.ts @@ -1,9 +1,9 @@ import { serve } from '@hono/node-server' import { serveStatic } from '@hono/node-server/serve-static' -import { transformSync } from 'amaro' import { html } from 'dhtml' import { renderToString } from 'dhtml/server' import { Hono } from 'hono' +import { stripTypeScriptTypes } from 'node:module' const app = new Hono() @@ -11,7 +11,7 @@ app.use('/node_modules/*', serveStatic({ root: './' })) app.get('/app/:script{.+.ts}', async (c, next) => { await next() - const { code } = transformSync(await c.res.text(), { mode: 'strip-only' }) + const code = stripTypeScriptTypes(await c.res.text()) c.res = c.body(code) c.res.headers.set('content-type', 'text/javascript') c.res.headers.delete('content-length') diff --git a/examples/ssr/package.json b/examples/ssr/package.json index c0575c2a..433297d6 100644 --- a/examples/ssr/package.json +++ b/examples/ssr/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "@hono/node-server": "^1.15.0", - "amaro": "^1.1.0", + "dhtml": "file:../../dist", "hono": "^4.8.3" }, "optionalDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6fd7a317..cf294e1e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -80,9 +80,6 @@ importers: '@hono/node-server': specifier: ^1.15.0 version: 1.19.1(hono@4.9.6) - amaro: - specifier: ^1.1.0 - version: 1.1.2 hono: specifier: ^4.8.3 version: 4.9.6 @@ -147,9 +144,6 @@ importers: '@types/istanbul-reports': specifier: ^3.0.4 version: 3.0.4 - amaro: - specifier: ^1.1.6 - version: 1.1.6 ast-v8-to-istanbul: specifier: ^0.3.11 version: 0.3.11 @@ -817,14 +811,6 @@ packages: alien-signals@3.1.2: resolution: {integrity: sha512-d9dYqZTS90WLiU0I5c6DHj/HcKkF8ZyGN3G5x8wSbslulz70KOxaqCT0hQCo9KOyhVqzqGojvNdJXoTumZOtcw==} - amaro@1.1.2: - resolution: {integrity: sha512-oJzgW3TS6b9tPOLFVFReAuSrg3QzFWs2TkMf/3fLjp77TKOL4EZpRR6ia9dO4g3R41J65D3J5ngCpFvRqk4yFQ==} - engines: {node: '>=22'} - - amaro@1.1.6: - resolution: {integrity: sha512-9vi6GC+Mx1sdYgMVMk90mfU8e8JOZXa8dVBmpkn1hjkGGmlQew6FYop4+RXZinsWFRWmL6cuBmJgQYxx3+jCpA==} - engines: {node: '>=22'} - ansi-regex@5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} @@ -1871,10 +1857,6 @@ snapshots: alien-signals@3.1.2: {} - amaro@1.1.2: {} - - amaro@1.1.6: {} - ansi-regex@5.0.1: {} ansi-styles@4.3.0: diff --git a/scripts/test/browser-runtime.ts b/scripts/test/browser-runtime.ts index e0d224d6..84a07ddf 100644 --- a/scripts/test/browser-runtime.ts +++ b/scripts/test/browser-runtime.ts @@ -1,9 +1,9 @@ import { serve } from '@hono/node-server' import { serveStatic } from '@hono/node-server/serve-static' -import { transformSync } from 'amaro' import { Hono } from 'hono' import * as path from 'node:path' import { fileURLToPath } from 'node:url' +import { stripTypeScriptTypes } from 'node:module' import * as puppeteer from 'puppeteer' import type { Runtime } from './main.ts' @@ -38,7 +38,7 @@ export async function create_browser_runtime(): Promise { app.use(async (c, next) => { await next() if (c.res.ok && c.req.path.endsWith('.ts')) { - const { code } = transformSync(await c.res.text(), { mode: 'strip-only' }) + const code = stripTypeScriptTypes(await c.res.text()) c.res = c.body(code) c.res.headers.set('content-type', 'text/javascript') c.res.headers.delete('content-length') diff --git a/scripts/test/package.json b/scripts/test/package.json index 976b9fb8..4d809e5f 100644 --- a/scripts/test/package.json +++ b/scripts/test/package.json @@ -6,7 +6,6 @@ "@types/istanbul-lib-coverage": "^2.0.6", "@types/istanbul-lib-report": "^3.0.3", "@types/istanbul-reports": "^3.0.4", - "amaro": "^1.1.6", "ast-v8-to-istanbul": "^0.3.11", "birpc": "^4.0.0", "devalue": "^5.6.2",