@acebuilder/component-tagger 0.1.2 → 0.1.4

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 CHANGED
@@ -26,11 +26,11 @@ export default componentTagger()(nextConfig)
26
26
 
27
27
  | Mode | Tagging |
28
28
  |------|---------|
29
- | `next dev` (Turbopack, default) | Skipped use runtime fiber resolution in the helper SDK |
30
- | `next dev --webpack` | Full build-time tagging |
31
- | `next build` | Full build-time tagging (webpack) |
29
+ | `next dev --turbopack` (default) | Build-time tagging via Turbopack custom loader rules |
30
+ | `next dev --webpack` | Build-time tagging via webpack pre-loader |
31
+ | `next build` | Build-time tagging (webpack) |
32
32
 
33
- Turbopack custom loader rules are disabled because they currently produce broken module paths (`welcome.tsx.tsx`).
33
+ Turbopack rules omit the `as` field including it caused broken module paths (`welcome.tsx.tsx`).
34
34
 
35
35
  ## AceBuilder sandboxes
36
36
 
package/index.d.ts CHANGED
@@ -8,8 +8,8 @@ export interface AceBuilderComponentTaggerOptions {
8
8
  export type WithAceBuilderComponentTagger = (config: NextConfig) => NextConfig
9
9
 
10
10
  /**
11
- * Next.js plugin — webpack pre-loader for component tagging.
12
- * Default Turbopack dev skips the loader (avoids `*.tsx.tsx` resolution bugs).
11
+ * Next.js plugin — tags JSX with data-acebuilder-* attributes.
12
+ * Works with Turbopack (`next dev --turbopack`) and webpack.
13
13
  */
14
14
  declare function withAceBuilderComponentTagger(
15
15
  options?: AceBuilderComponentTaggerOptions,
package/index.js CHANGED
@@ -3,8 +3,8 @@
3
3
  /**
4
4
  * Next.js plugin for AceBuilder component tagging.
5
5
  *
6
- * Uses a webpack pre-loader (works with `next dev --webpack` and production builds).
7
- * Turbopack custom loaders currently break module resolution (`*.tsx.tsx`) — not enabled.
6
+ * Works with both Turbopack (`next dev --turbopack`) and webpack (`next dev --webpack`).
7
+ * Note: Do NOT include `as` in the turbopack rules — that caused the `*.tsx.tsx` bug.
8
8
  */
9
9
  const TAGGER_LOADER = require.resolve('./lib/loader')
10
10
 
@@ -14,6 +14,20 @@ const componentTagger = (pluginOptions = {}) => (inputConfig = {}) => {
14
14
  /** @type {import('next').NextConfig} */
15
15
  const nextConfig = {
16
16
  ...inputConfig,
17
+ turbopack: {
18
+ ...(inputConfig.turbopack || {}),
19
+ rules: {
20
+ ...(inputConfig.turbopack?.rules || {}),
21
+ // Turbopack custom loader rules for JSX/TSX files.
22
+ // Omitting `as` preserves the original file type and avoids the *.tsx.tsx double-extension bug.
23
+ '*.tsx': {
24
+ loaders: [TAGGER_LOADER],
25
+ },
26
+ '*.jsx': {
27
+ loaders: [TAGGER_LOADER],
28
+ },
29
+ },
30
+ },
17
31
  webpack(config, options) {
18
32
  config.module.rules.push({
19
33
  test,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acebuilder/component-tagger",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "description": "Next.js dev loader to tag React components with AceBuilder metadata (Turbopack + webpack).",
6
6
  "main": "index.js",