esbuild-ignore-with-comments-plugin 0.1.1 → 0.3.2

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 +60 -0
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,3 +1,63 @@
1
+ [![npm version](https://badge.fury.io/js/esbuild-ignore-with-comments-plugin.svg)](https://badge.fury.io/js/esbuild-ignore-with-comments-plugin)
2
+
1
3
  # ESBuild Ignore with Comments Plugin
2
4
 
3
5
  Allows inserting comments into TypeScript source files. ESBuild will ignore these files during build.
6
+
7
+ ## Usage
8
+
9
+ Add to any `.ts` or `.tsx` file the following comment:
10
+
11
+ ```typescript
12
+ /* esbuild-ignore */
13
+ ```
14
+
15
+ This file will be replaced with a source file that has an empty object as a default export.
16
+
17
+ Configure the plugin for esbuild as follows:
18
+
19
+ ```typescript
20
+ import ignorePlugin from 'esbuild-ignore-with-comments-plugin';
21
+ import { build } from 'esbuild';
22
+
23
+ await build({
24
+ plugins: [ignorePlugin()],
25
+ });
26
+ ```
27
+
28
+ If you are bundling the same files multiple times (such as for server-side rendering) you can group files into sets and only ignore specific sets of files.
29
+
30
+ For instance, assume you have the following files:
31
+
32
+ `server.ts`
33
+
34
+ ```typescript
35
+ /* esbuild-ignore ui */
36
+
37
+ // some server only stuff
38
+ ```
39
+
40
+ `ui.ts`
41
+
42
+ ```typescript
43
+ /* esbuild-ignore server */
44
+
45
+ // some ui only stuff
46
+ ```
47
+
48
+ Then running the following will ignore `server.ts` during the build:
49
+
50
+ ```typescript
51
+ await build({
52
+ plugins: [ignorePlugin(['ui'])],
53
+ });
54
+ ```
55
+
56
+ Note that files that have the comment `/* esbuild-ignore */` without specifying a group will always be ignored.
57
+
58
+ Also note that if you want to add a file to multiple groups, you need to include multiple `esbuild-ignore` comments, such as:
59
+
60
+ ```typescript
61
+ /* esbuild-ignore server */
62
+ /* esbuild-ignore ui */
63
+ ```
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "esbuild-ignore-with-comments-plugin",
3
- "version": "0.1.1",
3
+ "version": "0.3.2",
4
4
  "description": "esbuild Plugin for ignoring files with specific comments in them",
5
5
  "keywords": [
6
6
  "node",
7
7
  "javascript",
8
8
  "esbuild"
9
9
  ],
10
- "homepage": "",
10
+ "homepage": "https://github.com/goldstack/goldstack/tree/master/workspaces/utils/packages/esbuild-ignore-with-comments-plugin",
11
11
  "bugs": {
12
12
  "url": "https://github.com/goldstack/goldstack/issues"
13
13
  },
@@ -33,8 +33,8 @@
33
33
  "version:apply": "utils-git changed --exec \"yarn version $@ && yarn version apply\""
34
34
  },
35
35
  "devDependencies": {
36
- "@goldstack/utils-git": "0.1.37",
37
- "@types/jest": "^28.1.8",
36
+ "@goldstack/utils-git": "0.2.2",
37
+ "@types/jest": "^29.0.1",
38
38
  "@types/node": "^18.7.13",
39
39
  "esbuild": "^0.15.5",
40
40
  "jest": "^28.1.0",