amaro 0.0.3 → 0.0.4

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/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Marco Ippolito
3
+ Copyright (c) Marco Ippolito and Amaro contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -11,7 +11,18 @@ The main goal of this package is to provide a stable API for TypeScript parser,
11
11
  To install Amaro, run:
12
12
 
13
13
  ```shell
14
- npm install -g amaro
14
+ npm install amaro
15
+ ```
16
+
17
+ ## How to Use
18
+
19
+ By default Amaro exports a `transformSync` function that performs type stripping.
20
+ Stack traces are preserved, by replacing removed types with white spaces.
21
+
22
+ ```javascript
23
+ const amaro = require('amaro');
24
+ const { code } = amaro.transformSync("const foo: string = 'bar';");
25
+ console.log(code); // "const foo = 'bar';"
15
26
  ```
16
27
 
17
28
  ## License (MIT)
package/dist/index.js CHANGED
@@ -553,20 +553,19 @@ module.exports.__wasm = wasm;
553
553
 
554
554
  }),
555
555
  "163": (function (module, __unused_webpack_exports, __webpack_require__) {
556
- const { transformSync } = __webpack_require__(858);
556
+ const swc = __webpack_require__(858);
557
557
  const DEFAULT_OPTIONS = {
558
558
  mode: "strip-only"
559
559
  };
560
560
  // biome-ignore lint/suspicious/noExplicitAny: Swc types are not available
561
- function transform(source, options) {
562
- const { code } = transformSync(source, {
561
+ function transformSync(source, options) {
562
+ return swc.transformSync(source, {
563
563
  ...DEFAULT_OPTIONS,
564
564
  ...options
565
565
  });
566
- return code;
567
566
  }
568
567
  module.exports = {
569
- transform
568
+ transformSync
570
569
  };
571
570
 
572
571