@runtime-type-inspector/parcel-transformer 1.0.0

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 +18 -0
  2. package/package.json +15 -0
package/index.mjs ADDED
@@ -0,0 +1,18 @@
1
+ import {Transformer} from '@parcel/plugin';
2
+ import {addTypeChecks} from 'runtime-type-inspector';
3
+ export default new Transformer({
4
+ async transform({asset}) {
5
+ // Retrieve the asset's source code and source map.
6
+ let source = await asset.getCode();
7
+ let sourceMap = await asset.getMap();
8
+ // Run it through some compiler, and set the results
9
+ // on the asset.
10
+ //let {code, map} = compile(source, sourceMap);
11
+ //asset.setCode(code);
12
+ //asset.setMap(map);
13
+ const code = addTypeChecks(source);
14
+ asset.setCode(code);
15
+ // Return the asset
16
+ return [asset];
17
+ }
18
+ });
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@runtime-type-inspector/parcel-transformer",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "Hermann Rolfes (kungfooman)",
10
+ "license": "MIT",
11
+ "dependencies": {
12
+ "@parcel/plugin": "^2.10.1",
13
+ "runtime-type-inspector": "^2.0.3"
14
+ }
15
+ }