240719.1 · 343b71f4d3027198bb84b007f7fc49a59a86f075
chore: prepared for v.0.0.4 release
reading declarations
.github/workflows/publish.yml
@@ -1,42 +0,0 @@-name: Publish releases--on:- push:- branches: [main]--jobs:- release-please:- runs-on: ubuntu-latest- outputs:- release_created: ${{ steps.release.outputs.release_created }}- release_tag: ${{ steps.release.outputs.tag_name }}- steps:- - uses: google-github-actions/release-please-action@v3- id: release- with:- release-type: simple- package-name: amaro-- npm-publish:- needs: release-please- if: ${{ needs.release-please.outputs.release_created }}- runs-on: ubuntu-latest- steps:- - uses: actions/checkout@v4-- - uses: actions/setup-node@v4- with:- node-version: lts/*-- - name: Publish to the npm registry- run: |- npm install- npm publish- env:- NPM_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}-- - run: npm pack --out amaro.tgz- - name: Add Amaro package archive to GitHub release- run: gh release upload ${{ needs.release-please.outputs.release_tag }} amaro.tgz- env:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
.github/workflows/tools.yml
@@ -24,7 +24,7 @@ permissions: jobs: tools-deps-update:- if: github.repository == 'marco-ippolito/amaro'+ if: github.repository == 'nodejs/amaro' runs-on: ubuntu-latest strategy: fail-fast: false # Prevent other jobs from aborting if one fails
@@ -0,0 +1 @@+# Changelog
@@ -0,0 +1,43 @@+# Contributing to Amaro++If you want to build Amaro yourself, you can build the project like this:++1. Clone this repository.+2. Run `npm install`.+3. Run `npm run build`.++The `dist/` directory now contains the Amaro build.+You can run the tests with `npm test`.++## Developer's Certificate of Origin 1.1++By making a contribution to this project, I certify that:++- (a) The contribution was created in whole or in part by me and I+ have the right to submit it under the open source license+ indicated in the file; or++- (b) The contribution is based upon previous work that, to the best+ of my knowledge, is covered under an appropriate open source+ license and I have the right under that license to submit that+ work with modifications, whether created in whole or in part+ by me, under the same open source license (unless I am+ permitted to submit under a different license), as indicated+ in the file; or++- (c) The contribution was provided directly to me by some other+ person who certified (a), (b) or (c) and I have not modified+ it.++- (d) I understand and agree that this project and the contribution+ are public and that a record of the contribution (including all+ personal information I submit with it, including my sign-off) is+ maintained indefinitely and may be redistributed consistent with+ this project or the open source license(s) involved.++## Moderation Policy++The [Node.js Moderation Policy] applies to this project.++[Node.js Moderation Policy]:+https://github.com/nodejs/admin/blob/master/Moderation-Policy.md
@@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Marco Ippolito+Copyright (c) Marco Ippolito and Amaro contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
@@ -11,7 +11,18 @@ The main goal of this package is to provide a stable API for TypeScript parser, To install Amaro, run: ```shell-npm install -g amaro+npm install amaro+```++## How to Use++By default Amaro exports a `transformSync` function that performs type stripping.+Stack traces are preserved, by replacing removed types with white spaces.++```javascript+const amaro = require('amaro');+const { code } = amaro.transformSync("const foo: string = 'bar';");+console.log(code); // "const foo = 'bar';" ``` ## License (MIT)
@@ -1,17 +1,17 @@ { "name": "amaro", "version": "0.0.3",- "description": "Blessed Node.js TypeScript loader",+ "description": "Node.js TypeScript wrapper", "license": "MIT", "type": "commonjs", "main": "dist/index.js",- "homepage": "https://github.com/marco-ippolito/amaro#readme",+ "homepage": "https://github.com/nodejs/amaro#readme", "bugs": {- "url": "https://github.com/marco-ippolito/amaro/issues"+ "url": "https://github.com/nodejs/amaro/issues" }, "repository": { "type": "git",- "url": "https://github.com/marco-ippolito/amaro.git"+ "url": "https://github.com/nodejs/amaro.git" }, "scripts": { "clean": "rimraf dist",@@ -31,9 +31,6 @@ "rimraf": "^6.0.1", "typescript": "^5.5.3" },- "engines": {- "node": "^20.15.0"- }, "exports": { "./package.json": "./package.json" },
@@ -1,18 +1,17 @@-const { transformSync } = require("../lib/swc/wasm");+const swc = require("../lib/swc/wasm.js"); const DEFAULT_OPTIONS = { mode: "strip-only", }; // biome-ignore lint/suspicious/noExplicitAny: Swc types are not available-function transform(source: string, options?: any): string {- const { code } = transformSync(source, {+function transformSync(source: string, options?: any): string {+ return swc.transformSync(source, { ...DEFAULT_OPTIONS, ...options, });- return code; } module.exports = {- transform,+ transformSync, };
@@ -1,11 +1,9 @@ const { test } = require("node:test"); const assert = require("node:assert");-const { transform } = require("../dist/index.js");+const { transformSync } = require("../dist/index.js"); test("should perform type stripping", () => {- assert.strictEqual(typeof transform, "function");- assert.strictEqual(- transform("const foo: string = 'bar';"),- "const foo = 'bar';",- );+ assert.strictEqual(typeof transformSync, "function");+ const { code } = transformSync("const foo: string = 'bar';");+ assert.strictEqual(code, "const foo = 'bar';"); });