rollup-plugin-conditional-compilation 1.0.0 → 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 (2) hide show
  1. package/README.md +20 -7
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -3,7 +3,13 @@
3
3
  [![npm version](https://img.shields.io/npm/v/rollup-plugin-conditional-compilation.svg)](https://www.npmjs.com/package/rollup-plugin-conditional-compilation) [![npm downloads](http://img.shields.io/npm/dm/rollup-plugin-conditional-compilation.svg)](https://npmcharts.com/compare/rollup-plugin-conditional-compilation,token-types?start=1200&interval=30)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/59dd6795e61949fb97066ca52e6097ef)](https://www.codacy.com/app/Borewit/rollup-plugin-conditional-compilation?utm_source=github.com&utm_medium=referral&utm_content=Borewit/rollup-plugin-conditional-compilation&utm_campaign=Badge_Grade)
5
5
 
6
- A simple plugin that allows you to include or exclude code blocks based on compile-time conditions. Works like `#if`, `#else`, `#elif` , `#endif` in C/C++.
6
+ A simple plugin that allows you to include or exclude code blocks based on compile-time conditions. Same as `#if`, `#else`, `#elif` , `#endif` in C/C++, it looks like this:
7
+
8
+ ```typescript
9
+ // #if DEBUG
10
+ console.log('user', userData); // when DEBUG is false, this line will be removed
11
+ // #endif
12
+ ```
7
13
 
8
14
  > **Note**: You should modify the plugin options to ensure **NOT to strip comments so quickly**, since we work with them. For example, with `@rollup/plugin-typescript`, set `removeComments: false`.
9
15
 
@@ -47,13 +53,20 @@ export default {
47
53
 
48
54
  ### Example
49
55
 
50
- Source:
56
+ Remove testing methods in your class when compiling for production:
51
57
 
52
- ```js
53
- // #if DEBUG
54
- console.log('debug');
55
- // #endif
56
- console.log('always');
58
+ ```typescript
59
+ class User {
60
+ private name: string;
61
+ private identifier: string;
62
+
63
+ // #if DEBUG
64
+ // This method will be removed in production build
65
+ _getTestData() {
66
+ return SomeImportantDataForTesting;
67
+ }
68
+ // #endif
69
+ }
57
70
  ```
58
71
 
59
72
  If `variables.DEBUG === false`, compiled output becomes:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup-plugin-conditional-compilation",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "projectType": "library",
5
5
  "author": {
6
6
  "name": "Kasukabe Tsumugi",