@runtime-type-inspector/plugin-parcel1 1.0.1

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 (3) hide show
  1. package/README.md +12 -0
  2. package/index.cjs +14 -0
  3. package/package.json +14 -0
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ This is the plugin for Parcel v1.
2
+
3
+ It's a two-step process to install it:
4
+
5
+ 1) `npm install --save-dev @runtime-type-inspector/plugin-parcel1`
6
+
7
+ 2) Add this to your Parcel v1 `build.js` file:
8
+
9
+ ```js
10
+ const bundler = new Bundler(entryFiles, options);
11
+ bundler.addAssetType('js', require.resolve('@runtime-type-inspector/plugin-parcel1'));
12
+ ```
package/index.cjs ADDED
@@ -0,0 +1,14 @@
1
+ const {addTypeChecks, expandType} = require('@runtime-type-inspector/transpiler');
2
+ const JSAsset = require('parcel-bundler/src/assets/JSAsset.js');
3
+ class JSAssetRuntimeTypeInspector extends JSAsset {
4
+ /**
5
+ * @override
6
+ * @returns {Promise<void>}
7
+ */
8
+ async pretransform() {
9
+ this.contents = addTypeChecks(this.contents, {expandType});
10
+ // continue the normal flow
11
+ return await super.pretransform();
12
+ }
13
+ }
14
+ module.exports = JSAssetRuntimeTypeInspector;
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@runtime-type-inspector/plugin-parcel1",
3
+ "version": "1.0.1",
4
+ "description": "RuntimeTypeInspector.js plugin for Parcel v1",
5
+ "main": "index.cjs",
6
+ "publishConfig": {"access": "public"},
7
+ "type": "commonjs",
8
+ "author": "Hermann Rolfes (kungfooman)",
9
+ "license": "MIT",
10
+ "dependencies": {
11
+ "parcel-bundler": "^1.12.5",
12
+ "@runtime-type-inspector/transpiler": "^2.2.5"
13
+ }
14
+ }