@basementstudio/mitt-next-plugin 0.0.0-stage → 0.2.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/LICENSE +15 -0
- package/dist/config.d.ts +44 -0
- package/dist/config.js +63 -0
- package/dist/config.js.map +1 -0
- package/dist/git.d.ts +33 -0
- package/dist/git.js +52 -0
- package/dist/git.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/loader.d.ts +21 -0
- package/dist/loader.js +71 -0
- package/dist/loader.js.map +1 -0
- package/dist/manifest.d.ts +15 -0
- package/dist/manifest.js +88 -0
- package/dist/manifest.js.map +1 -0
- package/dist/node.d.ts +2 -0
- package/dist/node.js +5 -0
- package/dist/node.js.map +1 -0
- package/dist/setup.d.ts +27 -0
- package/dist/setup.js +441 -0
- package/dist/setup.js.map +1 -0
- package/dist/transform.d.ts +40 -0
- package/dist/transform.js +365 -0
- package/dist/transform.js.map +1 -0
- package/dist/with-mitt.d.ts +29 -0
- package/dist/with-mitt.js +145 -0
- package/dist/with-mitt.js.map +1 -0
- package/package.json +72 -4
- package/README.md +0 -3
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { createHmac } from 'node:crypto';
|
|
2
|
+
import MagicString, {} from 'magic-string';
|
|
3
|
+
import { parseSync, visitorKeys } from 'oxc-parser';
|
|
4
|
+
// Elements that never render a box (or whose content React manages outside the host markup), so
|
|
5
|
+
// a pin can't land on them. `html` and `body` are tagged: they are valid fallbacks for a pin.
|
|
6
|
+
const SKIPPED_TAGS = new Set([
|
|
7
|
+
'head',
|
|
8
|
+
'script',
|
|
9
|
+
'style',
|
|
10
|
+
'meta',
|
|
11
|
+
'link',
|
|
12
|
+
'title',
|
|
13
|
+
'template',
|
|
14
|
+
'noscript',
|
|
15
|
+
'base',
|
|
16
|
+
]);
|
|
17
|
+
// Only characters a git SHA (plus `-dirty`) or a CI ref can contain, so the value can sit inside a
|
|
18
|
+
// JSX string literal without escaping.
|
|
19
|
+
const SAFE_COMMIT = /^[\w.-]{1,80}$/;
|
|
20
|
+
// Library components whose default export spreads unknown props onto a single DOM element, keyed
|
|
21
|
+
// by module specifier, with that element's tag: the one the widget records as the anchor's `tag`.
|
|
22
|
+
// Checked in Next 16.4: `next/image` and `next/legacy/image` spread `...rest` onto their `<img>`,
|
|
23
|
+
// `next/link` onto its `<a>`. An explicit list on purpose: an arbitrary component may drop the
|
|
24
|
+
// prop, or let it override a `data-fb` its own root already carries.
|
|
25
|
+
const FORWARDING_COMPONENTS = new Map([
|
|
26
|
+
['next/image', 'img'],
|
|
27
|
+
['next/image.js', 'img'],
|
|
28
|
+
['next/legacy/image', 'img'],
|
|
29
|
+
['next/legacy/image.js', 'img'],
|
|
30
|
+
['next/link', 'a'],
|
|
31
|
+
['next/link.js', 'a'],
|
|
32
|
+
]);
|
|
33
|
+
// Cheap pre-filter: a lowercase intrinsic always starts with `<` and a lowercase letter (JSX allows
|
|
34
|
+
// whitespace in between), and a forwarding component needs its import. Files with neither are
|
|
35
|
+
// returned before paying for a parse.
|
|
36
|
+
const MAYBE_TAGGED = /<\s*[a-z]|['"]next\/(?:legacy\/)?(?:image|link)(?:\.js)?['"]/;
|
|
37
|
+
const ID_LENGTH = 12;
|
|
38
|
+
export function createId(secret, relPath, line, column) {
|
|
39
|
+
return createHmac('sha256', secret)
|
|
40
|
+
.update(`${relPath}:${line}:${column}`)
|
|
41
|
+
.digest('hex')
|
|
42
|
+
.slice(0, ID_LENGTH);
|
|
43
|
+
}
|
|
44
|
+
function isNode(value) {
|
|
45
|
+
return typeof value === 'object' && value !== null && typeof value.type === 'string';
|
|
46
|
+
}
|
|
47
|
+
function identifierName(node) {
|
|
48
|
+
return isNode(node) && node.type === 'Identifier' && typeof node.name === 'string'
|
|
49
|
+
? node.name
|
|
50
|
+
: null;
|
|
51
|
+
}
|
|
52
|
+
const FUNCTION_TYPES = new Set([
|
|
53
|
+
'FunctionDeclaration',
|
|
54
|
+
'FunctionExpression',
|
|
55
|
+
'ArrowFunctionExpression',
|
|
56
|
+
]);
|
|
57
|
+
// The name a reader would use for the function at `ancestors[index]`, or null if it has none.
|
|
58
|
+
// Handles `function Foo`, `const Foo = () =>`, `const Foo = memo(() =>)`, class methods and
|
|
59
|
+
// `export default function () {}`.
|
|
60
|
+
function functionName(ancestors, index) {
|
|
61
|
+
const fn = ancestors[index];
|
|
62
|
+
if (!fn)
|
|
63
|
+
return null;
|
|
64
|
+
const own = identifierName(fn.id);
|
|
65
|
+
if (own)
|
|
66
|
+
return own;
|
|
67
|
+
let parentIndex = index - 1;
|
|
68
|
+
let parent = ancestors[parentIndex];
|
|
69
|
+
// Wrappers like `memo(...)` / `forwardRef(...)`: climb to whatever the call is assigned to.
|
|
70
|
+
while (parent?.type === 'CallExpression') {
|
|
71
|
+
parentIndex -= 1;
|
|
72
|
+
parent = ancestors[parentIndex];
|
|
73
|
+
}
|
|
74
|
+
if (!parent)
|
|
75
|
+
return null;
|
|
76
|
+
if (parent.type === 'VariableDeclarator')
|
|
77
|
+
return identifierName(parent.id);
|
|
78
|
+
if (parent.type === 'ExportDefaultDeclaration')
|
|
79
|
+
return 'default';
|
|
80
|
+
if (parent.type === 'MethodDefinition') {
|
|
81
|
+
const method = identifierName(parent.key);
|
|
82
|
+
if (!method)
|
|
83
|
+
return null;
|
|
84
|
+
// MethodDefinition sits in ClassBody, inside the class itself.
|
|
85
|
+
const className = identifierName(ancestors[parentIndex - 2]?.id);
|
|
86
|
+
return className ? `${className}.${method}` : method;
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
function nearestComponent(ancestors) {
|
|
91
|
+
for (let index = ancestors.length - 1; index >= 0; index--) {
|
|
92
|
+
const node = ancestors[index];
|
|
93
|
+
if (node && FUNCTION_TYPES.has(node.type)) {
|
|
94
|
+
const name = functionName(ancestors, index);
|
|
95
|
+
if (name)
|
|
96
|
+
return name;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
function stringValue(node) {
|
|
102
|
+
if (!isNode(node))
|
|
103
|
+
return null;
|
|
104
|
+
if (node.type === 'Literal')
|
|
105
|
+
return typeof node.value === 'string' ? node.value : null;
|
|
106
|
+
return identifierName(node);
|
|
107
|
+
}
|
|
108
|
+
/** Local names bound to the default export of a FORWARDING_COMPONENTS module, with their tag. */
|
|
109
|
+
function forwardingImports(program) {
|
|
110
|
+
const found = new Map();
|
|
111
|
+
const body = Array.isArray(program.body) ? program.body : [];
|
|
112
|
+
for (const statement of body) {
|
|
113
|
+
if (!isNode(statement) || statement.type !== 'ImportDeclaration')
|
|
114
|
+
continue;
|
|
115
|
+
if (statement.importKind === 'type')
|
|
116
|
+
continue;
|
|
117
|
+
const tag = FORWARDING_COMPONENTS.get(stringValue(statement.source) ?? '');
|
|
118
|
+
if (!tag || !Array.isArray(statement.specifiers))
|
|
119
|
+
continue;
|
|
120
|
+
for (const specifier of statement.specifiers) {
|
|
121
|
+
if (!isNode(specifier) || specifier.importKind === 'type')
|
|
122
|
+
continue;
|
|
123
|
+
const isDefault = specifier.type === 'ImportDefaultSpecifier' ||
|
|
124
|
+
(specifier.type === 'ImportSpecifier' && stringValue(specifier.imported) === 'default');
|
|
125
|
+
const local = identifierName(specifier.local);
|
|
126
|
+
if (isDefault && local)
|
|
127
|
+
found.set(local, tag);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return found;
|
|
131
|
+
}
|
|
132
|
+
function patternNames(pattern, names) {
|
|
133
|
+
if (!isNode(pattern))
|
|
134
|
+
return;
|
|
135
|
+
switch (pattern.type) {
|
|
136
|
+
case 'Identifier':
|
|
137
|
+
if (typeof pattern.name === 'string')
|
|
138
|
+
names.add(pattern.name);
|
|
139
|
+
return;
|
|
140
|
+
case 'ObjectPattern':
|
|
141
|
+
if (Array.isArray(pattern.properties)) {
|
|
142
|
+
for (const property of pattern.properties) {
|
|
143
|
+
if (isNode(property))
|
|
144
|
+
patternNames(property.type === 'Property' ? property.value : property, names);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return;
|
|
148
|
+
case 'ArrayPattern':
|
|
149
|
+
if (Array.isArray(pattern.elements))
|
|
150
|
+
for (const element of pattern.elements)
|
|
151
|
+
patternNames(element, names);
|
|
152
|
+
return;
|
|
153
|
+
case 'AssignmentPattern':
|
|
154
|
+
patternNames(pattern.left, names);
|
|
155
|
+
return;
|
|
156
|
+
case 'RestElement':
|
|
157
|
+
patternNames(pattern.argument, names);
|
|
158
|
+
return;
|
|
159
|
+
case 'TSParameterProperty':
|
|
160
|
+
patternNames(pattern.parameter, names);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Every value name declared in the file outside its imports. No scope analysis: a name declared
|
|
166
|
+
* anywhere at all counts, which can only make the transform tag less, never the wrong element.
|
|
167
|
+
*/
|
|
168
|
+
function declaredNames(program) {
|
|
169
|
+
const names = new Set();
|
|
170
|
+
const walk = (node) => {
|
|
171
|
+
if (node.type === 'ImportDeclaration')
|
|
172
|
+
return;
|
|
173
|
+
switch (node.type) {
|
|
174
|
+
case 'VariableDeclarator':
|
|
175
|
+
patternNames(node.id, names);
|
|
176
|
+
break;
|
|
177
|
+
case 'FunctionDeclaration':
|
|
178
|
+
case 'FunctionExpression':
|
|
179
|
+
case 'ArrowFunctionExpression':
|
|
180
|
+
patternNames(node.id, names);
|
|
181
|
+
if (Array.isArray(node.params))
|
|
182
|
+
for (const param of node.params)
|
|
183
|
+
patternNames(param, names);
|
|
184
|
+
break;
|
|
185
|
+
case 'ClassDeclaration':
|
|
186
|
+
case 'ClassExpression':
|
|
187
|
+
case 'TSEnumDeclaration':
|
|
188
|
+
case 'TSImportEqualsDeclaration':
|
|
189
|
+
case 'TSModuleDeclaration':
|
|
190
|
+
patternNames(node.id, names);
|
|
191
|
+
break;
|
|
192
|
+
case 'CatchClause':
|
|
193
|
+
patternNames(node.param, names);
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
const keys = visitorKeys[node.type];
|
|
197
|
+
if (!keys)
|
|
198
|
+
return;
|
|
199
|
+
for (const key of keys) {
|
|
200
|
+
const child = node[key];
|
|
201
|
+
if (Array.isArray(child)) {
|
|
202
|
+
for (const item of child)
|
|
203
|
+
if (isNode(item))
|
|
204
|
+
walk(item);
|
|
205
|
+
}
|
|
206
|
+
else if (isNode(child))
|
|
207
|
+
walk(child);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
walk(program);
|
|
211
|
+
return names;
|
|
212
|
+
}
|
|
213
|
+
/** The DOM tag `opening` renders, or null when it isn't one the transform tags. */
|
|
214
|
+
function hostTag(opening, forwarding) {
|
|
215
|
+
const name = opening.name;
|
|
216
|
+
if (!isNode(name) || name.type !== 'JSXIdentifier' || typeof name.name !== 'string')
|
|
217
|
+
return null;
|
|
218
|
+
const tag = name.name;
|
|
219
|
+
// Lowercase first letter is React's own rule for host elements; `Foo`, `foo.bar` and `svg:rect`
|
|
220
|
+
// are components or namespaced names and never reach the DOM as-is.
|
|
221
|
+
const first = tag.charCodeAt(0);
|
|
222
|
+
if (first >= 97 && first <= 122)
|
|
223
|
+
return tag;
|
|
224
|
+
const forwarded = forwarding.get(tag);
|
|
225
|
+
if (!forwarded)
|
|
226
|
+
return null;
|
|
227
|
+
// `<Link legacyBehavior>` clones its child instead of rendering an `<a>`, and drops its own
|
|
228
|
+
// props; the child is tagged on its own.
|
|
229
|
+
return hasAttribute(opening, 'legacyBehavior') ? null : forwarded;
|
|
230
|
+
}
|
|
231
|
+
function hasAttribute(opening, attribute) {
|
|
232
|
+
const attributes = opening.attributes;
|
|
233
|
+
if (!Array.isArray(attributes))
|
|
234
|
+
return false;
|
|
235
|
+
return attributes.some((item) => isNode(item) &&
|
|
236
|
+
item.type === 'JSXAttribute' &&
|
|
237
|
+
isNode(item.name) &&
|
|
238
|
+
item.name.type === 'JSXIdentifier' &&
|
|
239
|
+
item.name.name === attribute);
|
|
240
|
+
}
|
|
241
|
+
function lineStarts(source) {
|
|
242
|
+
const starts = [0];
|
|
243
|
+
for (let index = source.indexOf('\n'); index !== -1; index = source.indexOf('\n', index + 1)) {
|
|
244
|
+
starts.push(index + 1);
|
|
245
|
+
}
|
|
246
|
+
return starts;
|
|
247
|
+
}
|
|
248
|
+
function locate(starts, offset) {
|
|
249
|
+
let low = 0;
|
|
250
|
+
let high = starts.length - 1;
|
|
251
|
+
while (low < high) {
|
|
252
|
+
const mid = (low + high + 1) >> 1;
|
|
253
|
+
if ((starts[mid] ?? 0) <= offset)
|
|
254
|
+
low = mid;
|
|
255
|
+
else
|
|
256
|
+
high = mid - 1;
|
|
257
|
+
}
|
|
258
|
+
return { line: low + 1, column: offset - (starts[low] ?? 0) };
|
|
259
|
+
}
|
|
260
|
+
function langFor(relPath) {
|
|
261
|
+
return /\.m?jsx?$/.test(relPath) ? 'jsx' : 'tsx';
|
|
262
|
+
}
|
|
263
|
+
function unchanged(source, warning) {
|
|
264
|
+
return warning === undefined
|
|
265
|
+
? { code: source, map: null, entries: [] }
|
|
266
|
+
: { code: source, map: null, entries: [], warning };
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Injects an opaque `data-fb` ID on every lowercase host JSX element, and on the library components
|
|
270
|
+
* of FORWARDING_COMPONENTS (recorded with the tag they render). Pure: the same source and
|
|
271
|
+
* options always give the same output, which is what lets the manifest be rebuilt from git
|
|
272
|
+
* instead of collected from a (cached) build.
|
|
273
|
+
*/
|
|
274
|
+
export function transform(source, options) {
|
|
275
|
+
const { relPath, secret } = options;
|
|
276
|
+
let warning;
|
|
277
|
+
let commit = null;
|
|
278
|
+
if (options.commit) {
|
|
279
|
+
if (SAFE_COMMIT.test(options.commit))
|
|
280
|
+
commit = options.commit;
|
|
281
|
+
else
|
|
282
|
+
warning = `[mitt] ignored an unsafe commit value for ${relPath}`;
|
|
283
|
+
}
|
|
284
|
+
if (!MAYBE_TAGGED.test(source))
|
|
285
|
+
return unchanged(source, warning);
|
|
286
|
+
let program;
|
|
287
|
+
try {
|
|
288
|
+
const result = parseSync(relPath, source, {
|
|
289
|
+
lang: langFor(relPath),
|
|
290
|
+
sourceType: 'module',
|
|
291
|
+
preserveParens: false,
|
|
292
|
+
});
|
|
293
|
+
if (result.errors.length > 0) {
|
|
294
|
+
const first = result.errors[0]?.message ?? 'unknown error';
|
|
295
|
+
return unchanged(source, `[mitt] skipped ${relPath}: could not parse it (${first})`);
|
|
296
|
+
}
|
|
297
|
+
program = result.program;
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
301
|
+
return unchanged(source, `[mitt] skipped ${relPath}: could not parse it (${message})`);
|
|
302
|
+
}
|
|
303
|
+
const s = new MagicString(source);
|
|
304
|
+
const entries = [];
|
|
305
|
+
const starts = lineStarts(source);
|
|
306
|
+
const ancestors = [];
|
|
307
|
+
const forwarding = isNode(program) ? forwardingImports(program) : new Map();
|
|
308
|
+
if (forwarding.size > 0 && isNode(program)) {
|
|
309
|
+
// A local `Image` (a parameter, a nested component) may not be next/image at all.
|
|
310
|
+
for (const name of declaredNames(program))
|
|
311
|
+
forwarding.delete(name);
|
|
312
|
+
}
|
|
313
|
+
const visitOpening = (opening) => {
|
|
314
|
+
const tag = hostTag(opening, forwarding);
|
|
315
|
+
if (!tag || SKIPPED_TAGS.has(tag))
|
|
316
|
+
return;
|
|
317
|
+
// After `<Image<Props>` type arguments, which only a component can carry.
|
|
318
|
+
const nameEnd = isNode(opening.typeArguments)
|
|
319
|
+
? opening.typeArguments.end
|
|
320
|
+
: opening.name.end;
|
|
321
|
+
let insert = '';
|
|
322
|
+
if (!hasAttribute(opening, 'data-fb')) {
|
|
323
|
+
const { line, column } = locate(starts, opening.start);
|
|
324
|
+
const id = createId(secret, relPath, line, column);
|
|
325
|
+
entries.push({ id, file: relPath, line, column, tag, component: nearestComponent(ancestors) });
|
|
326
|
+
insert += ` data-fb="${id}"`;
|
|
327
|
+
}
|
|
328
|
+
if (tag === 'html' && commit && !hasAttribute(opening, 'data-fb-commit')) {
|
|
329
|
+
insert += ` data-fb-commit="${commit}"`;
|
|
330
|
+
}
|
|
331
|
+
if (insert)
|
|
332
|
+
s.appendLeft(nameEnd, insert);
|
|
333
|
+
};
|
|
334
|
+
const walk = (node) => {
|
|
335
|
+
if (node.type === 'JSXOpeningElement')
|
|
336
|
+
visitOpening(node);
|
|
337
|
+
const keys = visitorKeys[node.type];
|
|
338
|
+
if (!keys)
|
|
339
|
+
return;
|
|
340
|
+
ancestors.push(node);
|
|
341
|
+
for (const key of keys) {
|
|
342
|
+
const child = node[key];
|
|
343
|
+
if (Array.isArray(child)) {
|
|
344
|
+
for (const item of child)
|
|
345
|
+
if (isNode(item))
|
|
346
|
+
walk(item);
|
|
347
|
+
}
|
|
348
|
+
else if (isNode(child))
|
|
349
|
+
walk(child);
|
|
350
|
+
}
|
|
351
|
+
ancestors.pop();
|
|
352
|
+
};
|
|
353
|
+
if (isNode(program))
|
|
354
|
+
walk(program);
|
|
355
|
+
if (!s.hasChanged())
|
|
356
|
+
return unchanged(source, warning);
|
|
357
|
+
const map = options.sourceMap === false
|
|
358
|
+
? null
|
|
359
|
+
: s.generateMap({ hires: true, source: options.mapSource ?? relPath, includeContent: true });
|
|
360
|
+
const result = { code: s.toString(), map, entries };
|
|
361
|
+
if (warning !== undefined)
|
|
362
|
+
result.warning = warning;
|
|
363
|
+
return result;
|
|
364
|
+
}
|
|
365
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,WAAW,EAAE,EAAkB,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAA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;IACD,IAAI,MAAM,CAAC,OAAO,CAAC;QAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IAElC,IAAI,CAAC,CAAC,CAAC,UAAU,EAAE;QAAE,OAAO,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACtD,MAAM,GAAG,GACP,OAAO,CAAC,SAAS,KAAK,KAAK;QACzB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,SAAS,IAAI,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAA;IAChG,MAAM,MAAM,GAAoB,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,CAAA;IACpE,IAAI,OAAO,KAAK,SAAS;QAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;IACnD,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { NextConfig } from 'next';
|
|
2
|
+
export type { Entry, TransformOptions, TransformResult } from './transform.js';
|
|
3
|
+
export interface NextConfigContext {
|
|
4
|
+
defaultConfig: NextConfig;
|
|
5
|
+
}
|
|
6
|
+
export type NextConfigFunction = (phase: string, context: NextConfigContext) => NextConfig | Promise<NextConfig>;
|
|
7
|
+
export interface MittOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Lets `next build` fall back to the public dev secret when the secret env var is unset. Only
|
|
10
|
+
* for builds that are never deployed (e.g. a local e2e target); the IDs it produces can be
|
|
11
|
+
* reversed by anyone who can guess file paths.
|
|
12
|
+
*/
|
|
13
|
+
allowDevSecretInBuild?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The Next app directory. Defaults to the cwd, which is the app directory whenever Next runs
|
|
16
|
+
* from its package scripts. Next doesn't chdir, so `next build <dir>` from elsewhere needs this.
|
|
17
|
+
*/
|
|
18
|
+
root?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Serve the setup checklist at `/__mitt` under `next dev` (ADR 0013). Default true. Never part
|
|
21
|
+
* of a production build, whatever this says.
|
|
22
|
+
*/
|
|
23
|
+
setupPage?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The Node side of `withMitt` (see index.ts), loaded only when Next calls the config function. The
|
|
27
|
+
* secret itself never enters the config: Next writes the config into the server build output.
|
|
28
|
+
*/
|
|
29
|
+
export declare function applyMitt(nextConfig: NextConfig | NextConfigFunction, options: MittOptions, phase: string, context: NextConfigContext): Promise<NextConfig>;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { existsSync, realpathSync } from 'node:fs';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { PROJECT_ID_PATTERN } from '@basementstudio/mitt-shared/formats';
|
|
5
|
+
import { readMittConfig, resolveSecret, secretFingerprint } from './config.js';
|
|
6
|
+
import { resolveCommit } from './git.js';
|
|
7
|
+
// Values of `next/constants`, inlined so the plugin doesn't load Next at config time.
|
|
8
|
+
const PHASE_DEVELOPMENT_SERVER = 'phase-development-server';
|
|
9
|
+
const PHASE_PRODUCTION_BUILD = 'phase-production-build';
|
|
10
|
+
const LOADER_PATH = fileURLToPath(new URL('./loader.js', import.meta.url));
|
|
11
|
+
const JSX_GLOBS = ['*.tsx', '*.jsx'];
|
|
12
|
+
const NEXT_CONFIG_FILES = ['next.config.ts', 'next.config.mts', 'next.config.mjs', 'next.config.js'];
|
|
13
|
+
let warnedDevSecret = false;
|
|
14
|
+
let warnedNoApi = false;
|
|
15
|
+
// Next loads the config several times per build; git's answer doesn't change in between.
|
|
16
|
+
const commits = new Map();
|
|
17
|
+
function commitFor(root, live) {
|
|
18
|
+
const key = `${root}\0${live}\0${process.env.VERCEL_GIT_COMMIT_SHA ?? ''}`;
|
|
19
|
+
let commit = commits.get(key);
|
|
20
|
+
if (commit === undefined) {
|
|
21
|
+
commit = resolveCommit(root, { live });
|
|
22
|
+
commits.set(key, commit);
|
|
23
|
+
}
|
|
24
|
+
return commit;
|
|
25
|
+
}
|
|
26
|
+
// IDs are keyed by paths relative to this directory and the CLI rebuilds them from the same root,
|
|
27
|
+
// so a wrong guess would make every comment unresolvable (#2): fail the build instead.
|
|
28
|
+
function resolveRoot(option) {
|
|
29
|
+
const root = realpathSync(resolve(option ?? process.cwd()));
|
|
30
|
+
if (!NEXT_CONFIG_FILES.some((file) => existsSync(join(root, file)))) {
|
|
31
|
+
throw new Error(`[mitt] ${root} has no next.config file. Run Next from the app directory or pass ` +
|
|
32
|
+
'withMitt(config, { root }).');
|
|
33
|
+
}
|
|
34
|
+
return root;
|
|
35
|
+
}
|
|
36
|
+
// Only a fingerprint leaves this function; the loader re-reads the secret from the environment.
|
|
37
|
+
function secretOptions(secretEnv, allowDevSecret) {
|
|
38
|
+
const options = { secretEnv, allowDevSecret };
|
|
39
|
+
const { secret, devFallback } = resolveSecret(secretEnv, process.env, {
|
|
40
|
+
allowDev: allowDevSecret,
|
|
41
|
+
});
|
|
42
|
+
// No secret and no fallback: the loader fails the build when it first runs. Throwing here would
|
|
43
|
+
// also break `next typegen`, which loads the config in the build phase but never compiles.
|
|
44
|
+
if (secret === null)
|
|
45
|
+
return options;
|
|
46
|
+
if (devFallback && !warnedDevSecret) {
|
|
47
|
+
warnedDevSecret = true;
|
|
48
|
+
console.warn(`[mitt] ${secretEnv} is not set; using the public dev secret for data-fb IDs.`);
|
|
49
|
+
}
|
|
50
|
+
return { ...options, fingerprint: secretFingerprint(secret) };
|
|
51
|
+
}
|
|
52
|
+
function httpOrigin(value) {
|
|
53
|
+
if (!value?.trim())
|
|
54
|
+
return null;
|
|
55
|
+
try {
|
|
56
|
+
const url = new URL(value.trim());
|
|
57
|
+
return url.protocol === 'http:' || url.protocol === 'https:' ? url.origin : null;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// What <Mitt /> falls back to without props. Next inlines `env` into every bundle that reads these
|
|
64
|
+
// names, so only values already public in the loader tag may go here: never the secret or the CLI
|
|
65
|
+
// token (#3). Values the app set itself win.
|
|
66
|
+
function withEmbedEnv(config, project) {
|
|
67
|
+
const env = {};
|
|
68
|
+
const id = typeof project === 'string' ? project : process.env.MITT_PROJECT;
|
|
69
|
+
if (id && PROJECT_ID_PATTERN.test(id))
|
|
70
|
+
env.MITT_PROJECT = id;
|
|
71
|
+
const api = httpOrigin(process.env.MITT_API_URL);
|
|
72
|
+
if (api)
|
|
73
|
+
env.MITT_API_URL = api;
|
|
74
|
+
else if (!config.env?.MITT_API_URL && !warnedNoApi) {
|
|
75
|
+
warnedNoApi = true;
|
|
76
|
+
console.warn('[mitt] MITT_API_URL is not set, so <Mitt /> renders nothing unless it gets an `api` prop.');
|
|
77
|
+
}
|
|
78
|
+
return { ...config, env: { ...env, ...config.env } };
|
|
79
|
+
}
|
|
80
|
+
function onlyLoaders(items) {
|
|
81
|
+
return items.every((item) => typeof item === 'string' || 'loader' in item);
|
|
82
|
+
}
|
|
83
|
+
// Ours goes first so it sees the file exactly as it is on disk (and in git): IDs are keyed by
|
|
84
|
+
// line and column, and the manifest rebuilds them from the raw source.
|
|
85
|
+
function prependRule(existing, rule) {
|
|
86
|
+
if (existing === undefined)
|
|
87
|
+
return rule;
|
|
88
|
+
if (!Array.isArray(existing))
|
|
89
|
+
return [rule, existing];
|
|
90
|
+
// A plain list of loaders is shorthand for one rule; keep it as one rule.
|
|
91
|
+
if (onlyLoaders(existing))
|
|
92
|
+
return [rule, { loaders: existing }];
|
|
93
|
+
return [rule, ...existing];
|
|
94
|
+
}
|
|
95
|
+
function withTurbopackRules(config, loader) {
|
|
96
|
+
const rules = { ...config.turbopack?.rules };
|
|
97
|
+
for (const glob of JSX_GLOBS) {
|
|
98
|
+
rules[glob] = prependRule(rules[glob], {
|
|
99
|
+
condition: { not: 'foreign' },
|
|
100
|
+
loaders: [{ loader: LOADER_PATH, options: { ...loader } }],
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return { ...config, turbopack: { ...config.turbopack, rules } };
|
|
104
|
+
}
|
|
105
|
+
function withWebpackRule(config, loader) {
|
|
106
|
+
const userWebpack = config.webpack;
|
|
107
|
+
const webpack = (webpackConfig, context) => {
|
|
108
|
+
const target = webpackConfig;
|
|
109
|
+
target.module ??= {};
|
|
110
|
+
target.module.rules ??= [];
|
|
111
|
+
target.module.rules.push({
|
|
112
|
+
test: /\.[jt]sx$/,
|
|
113
|
+
exclude: /node_modules/,
|
|
114
|
+
enforce: 'pre',
|
|
115
|
+
use: [{ loader: LOADER_PATH, options: { ...loader } }],
|
|
116
|
+
});
|
|
117
|
+
return userWebpack ? userWebpack(webpackConfig, context) : webpackConfig;
|
|
118
|
+
};
|
|
119
|
+
return { ...config, webpack };
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The Node side of `withMitt` (see index.ts), loaded only when Next calls the config function. The
|
|
123
|
+
* secret itself never enters the config: Next writes the config into the server build output.
|
|
124
|
+
*/
|
|
125
|
+
export async function applyMitt(nextConfig, options, phase, context) {
|
|
126
|
+
const config = typeof nextConfig === 'function' ? await nextConfig(phase, context) : nextConfig;
|
|
127
|
+
// Only these phases compile code; `next start` and friends never run the loader.
|
|
128
|
+
if (phase !== PHASE_DEVELOPMENT_SERVER && phase !== PHASE_PRODUCTION_BUILD)
|
|
129
|
+
return config;
|
|
130
|
+
const root = resolveRoot(options.root);
|
|
131
|
+
const { secretEnv, project } = readMittConfig(root);
|
|
132
|
+
const allowDevSecret = phase === PHASE_DEVELOPMENT_SERVER || Boolean(options.allowDevSecretInBuild);
|
|
133
|
+
const loader = { ...secretOptions(secretEnv, allowDevSecret), root };
|
|
134
|
+
const commit = commitFor(root, phase === PHASE_DEVELOPMENT_SERVER);
|
|
135
|
+
// Loader options must be plain JSON without nulls, so a missing commit is simply omitted.
|
|
136
|
+
if (commit)
|
|
137
|
+
loader.commit = commit;
|
|
138
|
+
const withLoader = withWebpackRule(withTurbopackRules(withEmbedEnv(config, project), loader), loader);
|
|
139
|
+
if (phase !== PHASE_DEVELOPMENT_SERVER || options.setupPage === false)
|
|
140
|
+
return withLoader;
|
|
141
|
+
// Loaded only here, so builds never even import it.
|
|
142
|
+
const { setupServerFor, withSetupRewrites } = await import('./setup.js');
|
|
143
|
+
return withSetupRewrites(withLoader, (await setupServerFor(root)).target);
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=with-mitt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-mitt.js","sourceRoot":"","sources":["../src/with-mitt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AAExE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAKxC,sFAAsF;AACtF,MAAM,wBAAwB,GAAG,0BAA0B,CAAA;AAC3D,MAAM,sBAAsB,GAAG,wBAAwB,CAAA;AAoCvD,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,aAAa,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAC1E,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACpC,MAAM,iBAAiB,GAAG,CAAC,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,CAAC,CAAA;AAEpG,IAAI,eAAe,GAAG,KAAK,CAAA;AAC3B,IAAI,WAAW,GAAG,KAAK,CA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AK,sBAAsB;QAAE,OAAO,MAAM,CAAA;IAEzF,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACtC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,CAAA;IACnD,MAAM,cAAc,GAClB,KAAK,KAAK,wBAAwB,IAAI,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAC9E,MAAM,MAAM,GAAsB,EAAE,GAAG,aAAa,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,IAAI,EAAE,CAAA;IACvF,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,EAAE,KAAK,KAAK,wBAAwB,CAAC,CAAA;IAClE,0FAA0F;IAC1F,IAAI,MAAM;QAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;IAClC,MAAM,UAAU,GAAG,eAAe,CAChC,kBAAkB,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,EACzD,MAAM,CACP,CAAA;IACD,IAAI,KAAK,KAAK,wBAAwB,IAAI,OAAO,CAAC,SAAS,KAAK,KAAK;QAAE,OAAO,UAAU,CAAA;IACxF,oDAAoD;IACpD,MAAM,EAAE,cAAc,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAA;IACxE,OAAO,iBAAiB,CAAC,UAAU,EAAE,CAAC,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AAC3E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,74 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basementstudio/mitt-next-plugin",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Next.js plugin for Mitt: the <Mitt /> loader component, opaque data-fb IDs at build time (Turbopack and webpack), the private manifest rebuilt from git, and a dev-only setup page.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"mitt",
|
|
8
|
+
"feedback",
|
|
9
|
+
"nextjs",
|
|
10
|
+
"next-plugin",
|
|
11
|
+
"turbopack"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/basementstudio/mitt#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/basementstudio/mitt/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/basementstudio/mitt.git",
|
|
20
|
+
"directory": "packages/next-plugin"
|
|
21
|
+
},
|
|
22
|
+
"type": "module",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./loader": {
|
|
33
|
+
"types": "./dist/loader.d.ts",
|
|
34
|
+
"default": "./dist/loader.js"
|
|
35
|
+
},
|
|
36
|
+
"./manifest": {
|
|
37
|
+
"types": "./dist/manifest.d.ts",
|
|
38
|
+
"default": "./dist/manifest.js"
|
|
39
|
+
},
|
|
40
|
+
"./node": {
|
|
41
|
+
"types": "./dist/node.d.ts",
|
|
42
|
+
"default": "./dist/node.js"
|
|
43
|
+
},
|
|
44
|
+
"./package.json": "./package.json"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
48
|
+
"lint": "biome check .",
|
|
49
|
+
"typecheck": "tsc --noEmit",
|
|
50
|
+
"test": "vitest run"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@basementstudio/mitt-shared": "0.2.0",
|
|
54
|
+
"magic-string": "^1.4.3",
|
|
55
|
+
"oxc-parser": "^0.154.0"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@types/node": "^26.6.5",
|
|
59
|
+
"@types/react": "^19.3.0",
|
|
60
|
+
"@types/react-dom": "^19.3.0",
|
|
61
|
+
"next": "^16.4.2",
|
|
62
|
+
"react": "^19.3.1",
|
|
63
|
+
"react-dom": "^19.3.1",
|
|
64
|
+
"typescript": "7.0.2",
|
|
65
|
+
"vitest": "^5.0.5"
|
|
66
|
+
},
|
|
67
|
+
"peerDependencies": {
|
|
68
|
+
"next": ">=16",
|
|
69
|
+
"react": ">=19"
|
|
70
|
+
},
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"access": "public"
|
|
73
|
+
}
|
|
74
|
+
}
|
package/README.md
DELETED