@getglue/next-plugin 2.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.
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Glue instrumentation script component for Next.js
3
+ *
4
+ * Add this component to your root layout to enable Glue instrumentation:
5
+ *
6
+ * ```tsx
7
+ * import { GlueScript } from '@glue/next-plugin';
8
+ *
9
+ * export default function RootLayout({ children }) {
10
+ * return (
11
+ * <html>
12
+ * <head>
13
+ * <GlueScript />
14
+ * </head>
15
+ * <body>{children}</body>
16
+ * </html>
17
+ * );
18
+ * }
19
+ * ```
20
+ */
21
+ import * as React from 'react';
22
+ export declare function GlueScript(): React.JSX.Element | null;
23
+ //# sourceMappingURL=GlueScript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlueScript.d.ts","sourceRoot":"","sources":["../src/GlueScript.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,wBAAgB,UAAU,6BAYzB"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ /**
3
+ * Glue instrumentation script component for Next.js
4
+ *
5
+ * Add this component to your root layout to enable Glue instrumentation:
6
+ *
7
+ * ```tsx
8
+ * import { GlueScript } from '@glue/next-plugin';
9
+ *
10
+ * export default function RootLayout({ children }) {
11
+ * return (
12
+ * <html>
13
+ * <head>
14
+ * <GlueScript />
15
+ * </head>
16
+ * <body>{children}</body>
17
+ * </html>
18
+ * );
19
+ * }
20
+ * ```
21
+ */
22
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ var desc = Object.getOwnPropertyDescriptor(m, k);
25
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
26
+ desc = { enumerable: true, get: function() { return m[k]; } };
27
+ }
28
+ Object.defineProperty(o, k2, desc);
29
+ }) : (function(o, m, k, k2) {
30
+ if (k2 === undefined) k2 = k;
31
+ o[k2] = m[k];
32
+ }));
33
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
34
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
35
+ }) : function(o, v) {
36
+ o["default"] = v;
37
+ });
38
+ var __importStar = (this && this.__importStar) || (function () {
39
+ var ownKeys = function(o) {
40
+ ownKeys = Object.getOwnPropertyNames || function (o) {
41
+ var ar = [];
42
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
43
+ return ar;
44
+ };
45
+ return ownKeys(o);
46
+ };
47
+ return function (mod) {
48
+ if (mod && mod.__esModule) return mod;
49
+ var result = {};
50
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
51
+ __setModuleDefault(result, mod);
52
+ return result;
53
+ };
54
+ })();
55
+ Object.defineProperty(exports, "__esModule", { value: true });
56
+ exports.GlueScript = GlueScript;
57
+ const React = __importStar(require("react"));
58
+ const hook_inline_1 = require("./hook-inline");
59
+ function GlueScript() {
60
+ if (process.env.NODE_ENV !== 'development') {
61
+ return null;
62
+ }
63
+ // Inline the hook script directly in the HTML
64
+ // This ensures it runs before React loads
65
+ return (React.createElement("script", { dangerouslySetInnerHTML: { __html: hook_inline_1.GLUE_HOOK_SCRIPT } }));
66
+ }
67
+ //# sourceMappingURL=GlueScript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlueScript.js","sourceRoot":"","sources":["../src/GlueScript.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKH,gCAYC;AAfD,6CAA+B;AAC/B,+CAAiD;AAEjD,SAAgB,UAAU;IACxB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,8CAA8C;IAC9C,0CAA0C;IAC1C,OAAO,CACL,gCACE,uBAAuB,EAAE,EAAE,MAAM,EAAE,8BAAgB,EAAE,GACrD,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Browser-compatible Glue hook script (no requires, can be inlined)
3
+ */
4
+ export declare const GLUE_HOOK_SCRIPT = "\n(function() {\n 'use strict';\n\n // ID Generator (inlined from @glue/react-devtools-hook)\n function generateDeterministicId(relativeFile, line, column, tagName) {\n const input = relativeFile + ':' + line + ':' + column + ':' + tagName;\n\n // Simple hash function for browser (not cryptographic, just for stable IDs)\n let hash = 0;\n for (let i = 0; i < input.length; i++) {\n const char = input.charCodeAt(i);\n hash = ((hash << 5) - hash) + char;\n hash = hash & hash; // Convert to 32bit integer\n }\n\n // Convert to base36 string\n const hashStr = Math.abs(hash).toString(36);\n return 'auto:' + hashStr;\n }\n\n const ATTRIBUTE_PREFIX = 'data-agent';\n\n function isHostComponent(fiber) {\n return fiber.tag === 5; // HostComponent tag\n }\n\n function getDebugSource(fiber) {\n let current = fiber;\n let depth = 0;\n const maxDepth = 10;\n\n while (current && depth < maxDepth) {\n if (current._debugSource) {\n return current._debugSource;\n }\n current = current.return;\n depth++;\n }\n return null;\n }\n\n function instrumentElement(fiber) {\n if (!isHostComponent(fiber) || !fiber.stateNode) {\n return;\n }\n\n const element = fiber.stateNode;\n\n if (element.hasAttribute(ATTRIBUTE_PREFIX + '-id')) {\n return;\n }\n\n const source = getDebugSource(fiber);\n if (!source) {\n return;\n }\n\n const tagName = fiber.type || 'unknown';\n const agentId = generateDeterministicId(\n source.fileName,\n source.lineNumber,\n source.columnNumber || 0,\n tagName\n );\n\n try {\n element.setAttribute(ATTRIBUTE_PREFIX + '-id', agentId);\n element.setAttribute(ATTRIBUTE_PREFIX + '-source-file', source.fileName);\n element.setAttribute(ATTRIBUTE_PREFIX + '-source-line', String(source.lineNumber));\n if (source.columnNumber !== undefined) {\n element.setAttribute(ATTRIBUTE_PREFIX + '-source-col', String(source.columnNumber));\n }\n } catch (error) {\n console.debug('[Glue] Failed to set attributes:', error);\n }\n }\n\n function traverseFiber(fiber) {\n if (!fiber) return;\n instrumentElement(fiber);\n traverseFiber(fiber.child);\n traverseFiber(fiber.sibling);\n }\n\n function installGlueHook() {\n if (window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {\n console.warn('[Glue] React DevTools hook already exists');\n return;\n }\n\n const hook = {\n checkDCE: function() {},\n supportsFiber: true,\n renderers: new Map(),\n inject: function(renderer) {\n const id = Math.random();\n hook.renderers.set(id, renderer);\n return id;\n },\n onCommitFiberRoot: function(rendererID, root, priorityLevel) {\n try {\n if (root && root.current) {\n traverseFiber(root.current);\n }\n } catch (error) {\n console.error('[Glue] Error in onCommitFiberRoot:', error);\n }\n },\n onCommitFiberUnmount: function() {},\n onPostCommitFiberRoot: function() {},\n sub: function() { return function() {}; },\n emit: function() {}\n };\n\n window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = hook;\n console.log('[Glue] React DevTools hook installed');\n }\n\n if (typeof window !== 'undefined') {\n installGlueHook();\n }\n})();\n";
5
+ //# sourceMappingURL=hook-inline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook-inline.d.ts","sourceRoot":"","sources":["../src/hook-inline.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,gBAAgB,m1GA2H5B,CAAC"}
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ /**
3
+ * Browser-compatible Glue hook script (no requires, can be inlined)
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.GLUE_HOOK_SCRIPT = void 0;
7
+ exports.GLUE_HOOK_SCRIPT = `
8
+ (function() {
9
+ 'use strict';
10
+
11
+ // ID Generator (inlined from @glue/react-devtools-hook)
12
+ function generateDeterministicId(relativeFile, line, column, tagName) {
13
+ const input = relativeFile + ':' + line + ':' + column + ':' + tagName;
14
+
15
+ // Simple hash function for browser (not cryptographic, just for stable IDs)
16
+ let hash = 0;
17
+ for (let i = 0; i < input.length; i++) {
18
+ const char = input.charCodeAt(i);
19
+ hash = ((hash << 5) - hash) + char;
20
+ hash = hash & hash; // Convert to 32bit integer
21
+ }
22
+
23
+ // Convert to base36 string
24
+ const hashStr = Math.abs(hash).toString(36);
25
+ return 'auto:' + hashStr;
26
+ }
27
+
28
+ const ATTRIBUTE_PREFIX = 'data-agent';
29
+
30
+ function isHostComponent(fiber) {
31
+ return fiber.tag === 5; // HostComponent tag
32
+ }
33
+
34
+ function getDebugSource(fiber) {
35
+ let current = fiber;
36
+ let depth = 0;
37
+ const maxDepth = 10;
38
+
39
+ while (current && depth < maxDepth) {
40
+ if (current._debugSource) {
41
+ return current._debugSource;
42
+ }
43
+ current = current.return;
44
+ depth++;
45
+ }
46
+ return null;
47
+ }
48
+
49
+ function instrumentElement(fiber) {
50
+ if (!isHostComponent(fiber) || !fiber.stateNode) {
51
+ return;
52
+ }
53
+
54
+ const element = fiber.stateNode;
55
+
56
+ if (element.hasAttribute(ATTRIBUTE_PREFIX + '-id')) {
57
+ return;
58
+ }
59
+
60
+ const source = getDebugSource(fiber);
61
+ if (!source) {
62
+ return;
63
+ }
64
+
65
+ const tagName = fiber.type || 'unknown';
66
+ const agentId = generateDeterministicId(
67
+ source.fileName,
68
+ source.lineNumber,
69
+ source.columnNumber || 0,
70
+ tagName
71
+ );
72
+
73
+ try {
74
+ element.setAttribute(ATTRIBUTE_PREFIX + '-id', agentId);
75
+ element.setAttribute(ATTRIBUTE_PREFIX + '-source-file', source.fileName);
76
+ element.setAttribute(ATTRIBUTE_PREFIX + '-source-line', String(source.lineNumber));
77
+ if (source.columnNumber !== undefined) {
78
+ element.setAttribute(ATTRIBUTE_PREFIX + '-source-col', String(source.columnNumber));
79
+ }
80
+ } catch (error) {
81
+ console.debug('[Glue] Failed to set attributes:', error);
82
+ }
83
+ }
84
+
85
+ function traverseFiber(fiber) {
86
+ if (!fiber) return;
87
+ instrumentElement(fiber);
88
+ traverseFiber(fiber.child);
89
+ traverseFiber(fiber.sibling);
90
+ }
91
+
92
+ function installGlueHook() {
93
+ if (window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
94
+ console.warn('[Glue] React DevTools hook already exists');
95
+ return;
96
+ }
97
+
98
+ const hook = {
99
+ checkDCE: function() {},
100
+ supportsFiber: true,
101
+ renderers: new Map(),
102
+ inject: function(renderer) {
103
+ const id = Math.random();
104
+ hook.renderers.set(id, renderer);
105
+ return id;
106
+ },
107
+ onCommitFiberRoot: function(rendererID, root, priorityLevel) {
108
+ try {
109
+ if (root && root.current) {
110
+ traverseFiber(root.current);
111
+ }
112
+ } catch (error) {
113
+ console.error('[Glue] Error in onCommitFiberRoot:', error);
114
+ }
115
+ },
116
+ onCommitFiberUnmount: function() {},
117
+ onPostCommitFiberRoot: function() {},
118
+ sub: function() { return function() {}; },
119
+ emit: function() {}
120
+ };
121
+
122
+ window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = hook;
123
+ console.log('[Glue] React DevTools hook installed');
124
+ }
125
+
126
+ if (typeof window !== 'undefined') {
127
+ installGlueHook();
128
+ }
129
+ })();
130
+ `;
131
+ //# sourceMappingURL=hook-inline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook-inline.js","sourceRoot":"","sources":["../src/hook-inline.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEU,QAAA,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2H/B,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { GlueNextPluginOptions, NextConfig } from './types';
2
+ /**
3
+ * Wrap Next.js config with Glue React instrumentation
4
+ *
5
+ * Usage:
6
+ * ```javascript
7
+ * const { withGlue } = require('@glue/next-plugin');
8
+ *
9
+ * module.exports = withGlue({
10
+ * // your Next.js config
11
+ * });
12
+ * ```
13
+ *
14
+ * @param nextConfig - Existing Next.js configuration object
15
+ * @param options - Glue plugin options
16
+ * @returns Enhanced Next.js configuration with Glue instrumentation
17
+ */
18
+ export declare function withGlue(nextConfig?: NextConfig, options?: GlueNextPluginOptions): NextConfig;
19
+ export type { GlueNextPluginOptions, NextConfig } from './types';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEjE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CACtB,UAAU,GAAE,UAAe,EAC3B,OAAO,GAAE,qBAA0B,GAClC,UAAU,CAmEZ;AAGD,YAAY,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withGlue = withGlue;
4
+ /**
5
+ * Wrap Next.js config with Glue React instrumentation
6
+ *
7
+ * Usage:
8
+ * ```javascript
9
+ * const { withGlue } = require('@glue/next-plugin');
10
+ *
11
+ * module.exports = withGlue({
12
+ * // your Next.js config
13
+ * });
14
+ * ```
15
+ *
16
+ * @param nextConfig - Existing Next.js configuration object
17
+ * @param options - Glue plugin options
18
+ * @returns Enhanced Next.js configuration with Glue instrumentation
19
+ */
20
+ function withGlue(nextConfig = {}, options = {}) {
21
+ const { enabled = process.env.NODE_ENV === 'development', attributePrefix = 'data-agent', relativeTo } = options;
22
+ if (!enabled) {
23
+ return nextConfig;
24
+ }
25
+ return {
26
+ ...nextConfig,
27
+ webpack(config, context) {
28
+ // Apply to BOTH server and client builds to avoid hydration mismatches
29
+ const buildType = context.isServer ? 'server-side' : 'client-side';
30
+ console.log(`[Glue Plugin] Configuring webpack for ${buildType} build`);
31
+ // Add a custom plugin to selectively alias jsx-runtime imports
32
+ // Only apply the alias to user code, not to our wrapper package
33
+ // This prevents infinite recursion where our wrapper imports itself
34
+ config.plugins = config.plugins || [];
35
+ config.plugins.push(new (class {
36
+ apply(compiler) {
37
+ console.log(`[Glue Plugin] Webpack plugin applied (${buildType})`);
38
+ compiler.hooks.normalModuleFactory.tap('GlueJsxRuntimeAlias', (nmf) => {
39
+ nmf.hooks.beforeResolve.tap('GlueJsxRuntimeAlias', (resolveData) => {
40
+ if (!resolveData)
41
+ return;
42
+ const request = resolveData.request;
43
+ const issuer = resolveData.contextInfo?.issuer || '';
44
+ // Skip aliasing if the import comes from our own wrapper package
45
+ // This allows our wrapper to import the real React
46
+ if (issuer.includes('@glue/jsx-runtime') || issuer.includes('jsx-runtime')) {
47
+ if (request === 'react/jsx-runtime' || request === 'react/jsx-dev-runtime') {
48
+ console.log('[Glue Plugin] Skipping alias (wrapper package):', { request, issuer });
49
+ }
50
+ return;
51
+ }
52
+ // Apply alias for user code (SWC-compiled JSX)
53
+ if (request === 'react/jsx-runtime') {
54
+ const newPath = require.resolve('@glue/jsx-runtime/jsx-runtime');
55
+ console.log('[Glue Plugin] Aliasing jsx-runtime:', { from: request, to: newPath, issuer });
56
+ resolveData.request = newPath;
57
+ }
58
+ else if (request === 'react/jsx-dev-runtime') {
59
+ const newPath = require.resolve('@glue/jsx-runtime/jsx-dev-runtime');
60
+ console.log('[Glue Plugin] Aliasing jsx-dev-runtime:', { from: request, to: newPath, issuer });
61
+ resolveData.request = newPath;
62
+ }
63
+ });
64
+ });
65
+ }
66
+ })());
67
+ // Call original webpack config if it exists
68
+ if (typeof nextConfig.webpack === 'function') {
69
+ config = nextConfig.webpack(config, context);
70
+ }
71
+ return config;
72
+ }
73
+ };
74
+ }
75
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":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Glue Next.js plugin
3
+ */
4
+ export interface GlueNextPluginOptions {
5
+ /**
6
+ * Enable/disable Glue instrumentation
7
+ * @default process.env.NODE_ENV === 'development'
8
+ */
9
+ enabled?: boolean;
10
+ /**
11
+ * Attribute prefix for injected data attributes
12
+ * @default 'data-agent'
13
+ */
14
+ attributePrefix?: string;
15
+ /**
16
+ * Project root for relative path calculation
17
+ * @default process.cwd()
18
+ */
19
+ relativeTo?: string;
20
+ }
21
+ /**
22
+ * Next.js configuration object (simplified type)
23
+ */
24
+ export interface NextConfig {
25
+ webpack?: (config: any, context: any) => any;
26
+ [key: string]: any;
27
+ }
28
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,KAAK,GAAG,CAAC;IAC7C,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@getglue/next-plugin",
3
+ "version": "2.1.0",
4
+ "description": "Next.js plugin for Glue React instrumentation via DevTools hook",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/billwithwillow/glue.git",
14
+ "directory": "packages/next-plugin"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "watch": "tsc --watch",
22
+ "clean": "rm -rf dist"
23
+ },
24
+ "keywords": [
25
+ "nextjs",
26
+ "plugin",
27
+ "react",
28
+ "devtools",
29
+ "instrumentation"
30
+ ],
31
+ "author": "Tejas Priyadarshi",
32
+ "license": "MIT",
33
+ "dependencies": {
34
+ "@getglue/react-devtools-hook": "*"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^20.11.19",
38
+ "typescript": "^5.3.3"
39
+ },
40
+ "peerDependencies": {
41
+ "@getglue/jsx-runtime": "^2.1.0",
42
+ "next": ">=14.0.0"
43
+ }
44
+ }