macaly-tagger 1.0.1 → 1.1.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.
- package/README.md +67 -1
- package/dist/macaly-tagger-loader.js +2 -2
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +17 -19
package/README.md
CHANGED
|
@@ -26,6 +26,47 @@ The loader has the following dependencies that will be installed automatically:
|
|
|
26
26
|
|
|
27
27
|
### Next.js Setup
|
|
28
28
|
|
|
29
|
+
#### For Next.js 15.3.0+ with Turbopack
|
|
30
|
+
|
|
31
|
+
Configure your `next.config.js`:
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
/** @type {import('next').NextConfig} */
|
|
35
|
+
const nextConfig = {
|
|
36
|
+
turbopack: {
|
|
37
|
+
rules: {
|
|
38
|
+
"*.{jsx,tsx}": {
|
|
39
|
+
condition: {
|
|
40
|
+
all: [
|
|
41
|
+
{ not: "foreign" }, // Exclude node_modules
|
|
42
|
+
"development", // Only in development mode
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
loaders: [
|
|
46
|
+
{
|
|
47
|
+
loader: "macaly-tagger",
|
|
48
|
+
options: {
|
|
49
|
+
disableSourceMaps: true, // Required to avoid Turbopack crashes
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
as: "*", // Preserve original file handling
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
module.exports = nextConfig;
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
> **Important Notes for Turbopack:**
|
|
63
|
+
> - **`disableSourceMaps: true` is required** to prevent Turbopack crashes when processing source maps
|
|
64
|
+
> - **`as: "*"`** preserves the original file type handling (don't use `"*.js"`)
|
|
65
|
+
> - **Don't include `'browser'` condition** as it may exclude server components in Next.js
|
|
66
|
+
> - The simple `"*.{jsx,tsx}"` glob pattern works correctly with these settings
|
|
67
|
+
|
|
68
|
+
#### For Next.js with Webpack (legacy)
|
|
69
|
+
|
|
29
70
|
Configure your `next.config.js`:
|
|
30
71
|
|
|
31
72
|
```js
|
|
@@ -144,6 +185,25 @@ The loader works out of the box with no configuration needed. It automatically:
|
|
|
144
185
|
- Runs only in development mode (when configured properly)
|
|
145
186
|
- Handles both regular JSX elements (`<div>`) and member expressions (`<MyLib.Button>`)
|
|
146
187
|
|
|
188
|
+
### Options
|
|
189
|
+
|
|
190
|
+
You can pass options to the loader:
|
|
191
|
+
|
|
192
|
+
```js
|
|
193
|
+
{
|
|
194
|
+
loader: 'macaly-tagger',
|
|
195
|
+
options: {
|
|
196
|
+
debug: true, // Enable debug logging
|
|
197
|
+
disableSourceMaps: true, // Disable source map generation (useful for Turbopack)
|
|
198
|
+
},
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
| Option | Type | Default | Description |
|
|
203
|
+
|--------|------|---------|-------------|
|
|
204
|
+
| `debug` | `boolean` | `false` | Enable detailed console logging for debugging |
|
|
205
|
+
| `disableSourceMaps` | `boolean` | `false` | Disable source map generation (recommended for Turbopack to avoid crashes) |
|
|
206
|
+
|
|
147
207
|
## Attributes Added
|
|
148
208
|
|
|
149
209
|
For each JSX element, the loader adds:
|
|
@@ -171,7 +231,7 @@ Once installed, you can:
|
|
|
171
231
|
### Build errors?
|
|
172
232
|
|
|
173
233
|
1. **Install dependencies**: Ensure all peer dependencies are installed
|
|
174
|
-
2. **Check webpack version**: Requires webpack >= 4.0.0
|
|
234
|
+
2. **Check webpack version**: Requires webpack >= 4.0.0 (for webpack setup)
|
|
175
235
|
3. **Verify loader path**: Make sure the loader is correctly referenced
|
|
176
236
|
|
|
177
237
|
### Performance issues?
|
|
@@ -211,6 +271,12 @@ MIT License - see LICENSE file for details.
|
|
|
211
271
|
|
|
212
272
|
## Changelog
|
|
213
273
|
|
|
274
|
+
### 1.1.0
|
|
275
|
+
|
|
276
|
+
- Added `disableSourceMaps` option to prevent Turbopack crashes
|
|
277
|
+
- Added comprehensive Turbopack configuration documentation
|
|
278
|
+
- Tested and verified Turbopack compatibility with Next.js 15.3.0+
|
|
279
|
+
|
|
214
280
|
### 1.0.0
|
|
215
281
|
|
|
216
282
|
- Initial release
|
|
@@ -177,7 +177,7 @@ const macalyTaggerLoader = function (code) {
|
|
|
177
177
|
}
|
|
178
178
|
return {
|
|
179
179
|
code: transformedCode,
|
|
180
|
-
map: ms.generateMap({ hires: true }),
|
|
180
|
+
map: options.disableSourceMaps ? null : ms.generateMap({ hires: true }),
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
183
|
catch (error) {
|
|
@@ -188,7 +188,7 @@ const macalyTaggerLoader = function (code) {
|
|
|
188
188
|
transform()
|
|
189
189
|
.then((result) => {
|
|
190
190
|
if (result) {
|
|
191
|
-
callback(null, result.code, result.map);
|
|
191
|
+
callback(null, result.code, result.map || undefined);
|
|
192
192
|
}
|
|
193
193
|
else {
|
|
194
194
|
callback(null, code);
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LoaderDefinitionFunction } from 'webpack';
|
|
2
2
|
export interface MacalyTaggerLoaderOptions {
|
|
3
3
|
debug?: boolean;
|
|
4
|
+
disableSourceMaps?: boolean;
|
|
4
5
|
}
|
|
5
6
|
export interface SourceLocation {
|
|
6
7
|
line: number;
|
|
@@ -13,7 +14,7 @@ export interface JSXElementInfo {
|
|
|
13
14
|
}
|
|
14
15
|
export interface TransformResult {
|
|
15
16
|
code: string;
|
|
16
|
-
map: any;
|
|
17
|
+
map: any | null;
|
|
17
18
|
}
|
|
18
19
|
export type MacalyTaggerLoader = LoaderDefinitionFunction<MacalyTaggerLoaderOptions>;
|
|
19
20
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;CACjB;AAED,MAAM,MAAM,kBAAkB,GAAG,wBAAwB,CAAC,yBAAyB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "macaly-tagger",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A webpack loader that adds location metadata to JSX elements for development debugging",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,22 +13,6 @@
|
|
|
13
13
|
},
|
|
14
14
|
"./package.json": "./package.json"
|
|
15
15
|
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "tsc -p tsconfig.build.json",
|
|
18
|
-
"build:watch": "tsc -p tsconfig.build.json --watch",
|
|
19
|
-
"clean": "rimraf dist",
|
|
20
|
-
"dev": "tsc -p tsconfig.build.json --watch",
|
|
21
|
-
"lint": "eslint src --ext .ts,.tsx",
|
|
22
|
-
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
23
|
-
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
24
|
-
"format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
|
|
25
|
-
"test": "vitest run",
|
|
26
|
-
"test:watch": "vitest",
|
|
27
|
-
"test:coverage": "vitest run --coverage",
|
|
28
|
-
"type-check": "tsc --noEmit",
|
|
29
|
-
"prepublishOnly": "npm run clean && npm run build && npm run test && npm run lint",
|
|
30
|
-
"prepack": "npm run build"
|
|
31
|
-
},
|
|
32
16
|
"keywords": [
|
|
33
17
|
"webpack",
|
|
34
18
|
"loader",
|
|
@@ -84,5 +68,19 @@
|
|
|
84
68
|
"bugs": {
|
|
85
69
|
"url": "https://github.com/langtail/macaly-tagger/issues"
|
|
86
70
|
},
|
|
87
|
-
"homepage": "https://github.com/langtail/macaly-tagger#readme"
|
|
88
|
-
|
|
71
|
+
"homepage": "https://github.com/langtail/macaly-tagger#readme",
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "tsc -p tsconfig.build.json",
|
|
74
|
+
"build:watch": "tsc -p tsconfig.build.json --watch",
|
|
75
|
+
"clean": "rimraf dist",
|
|
76
|
+
"dev": "tsc -p tsconfig.build.json --watch",
|
|
77
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
78
|
+
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
79
|
+
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
80
|
+
"format:check": "prettier --check \"src/**/*.{ts,tsx}\"",
|
|
81
|
+
"test": "vitest run",
|
|
82
|
+
"test:watch": "vitest",
|
|
83
|
+
"test:coverage": "vitest run --coverage",
|
|
84
|
+
"type-check": "tsc --noEmit"
|
|
85
|
+
}
|
|
86
|
+
}
|