@runtime-type-inspector/parcel-transformer 1.0.4 → 1.0.5

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.
Files changed (2) hide show
  1. package/index.mjs +5 -2
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import {Transformer} from '@parcel/plugin';
2
- import {addTypeChecks} from '@runtime-type-inspector/transpiler';
2
+ import {addTypeChecks, expandType} from '@runtime-type-inspector/transpiler';
3
3
  export default new Transformer({
4
4
  async transform({asset}) {
5
5
  // Retrieve the asset's source code and source map.
@@ -10,7 +10,10 @@ export default new Transformer({
10
10
  //let {code, map} = compile(source, sourceMap);
11
11
  //asset.setCode(code);
12
12
  //asset.setMap(map);
13
- const code = addTypeChecks(source);
13
+ // Unfortunately Parcel generates unusable code while adding an import via plugin.
14
+ // Not adding the import results in function calls that can simple be polyfilled into `window`.
15
+ // TODO: Open issue on Parcel or find another way.
16
+ const code = addTypeChecks(source, {expandType, addHeader: false});
14
17
  asset.setCode(code);
15
18
  // Return the asset
16
19
  return [asset];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtime-type-inspector/parcel-transformer",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "",
5
5
  "main": "index.mjs",
6
6
  "author": "Hermann Rolfes (kungfooman)",