amaro 0.0.2 → 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,45 +553,19 @@ module.exports.__wasm = wasm;
553
553
 
554
554
  }),
555
555
  "163": (function (module, __unused_webpack_exports, __webpack_require__) {
556
- function _define_property(obj, key, value) {
557
- if (key in obj) {
558
- Object.defineProperty(obj, key, {
559
- value: value,
560
- enumerable: true,
561
- configurable: true,
562
- writable: true
563
- });
564
- } else {
565
- obj[key] = value;
566
- }
567
- return obj;
568
- }
569
- function _object_spread(target) {
570
- for(var i = 1; i < arguments.length; i++){
571
- var source = arguments[i] != null ? arguments[i] : {};
572
- var ownKeys = Object.keys(source);
573
- if (typeof Object.getOwnPropertySymbols === "function") {
574
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
575
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
576
- }));
577
- }
578
- ownKeys.forEach(function(key) {
579
- _define_property(target, key, source[key]);
580
- });
581
- }
582
- return target;
583
- }
584
- var transformSync = (__webpack_require__(858)/* .transformSync */.transformSync);
585
- var DEFAULT_OPTIONS = {
556
+ const swc = __webpack_require__(858);
557
+ const DEFAULT_OPTIONS = {
586
558
  mode: "strip-only"
587
559
  };
588
560
  // biome-ignore lint/suspicious/noExplicitAny: Swc types are not available
589
- function transform(source, options) {
590
- var code = transformSync(source, _object_spread({}, DEFAULT_OPTIONS, options)).code;
591
- return code;
561
+ function transformSync(source, options) {
562
+ return swc.transformSync(source, {
563
+ ...DEFAULT_OPTIONS,
564
+ ...options
565
+ });
592
566
  }
593
567
  module.exports = {
594
- transform: transform
568
+ transformSync
595
569
  };
596
570
 
597
571