@pyreon/core 0.24.0 → 0.24.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.
- package/lib/analysis/index.js.html +1 -1
- package/lib/index.js +8 -6
- package/package.json +2 -2
- package/src/lifecycle.ts +30 -8
- package/src/tests/lifecycle.test.ts +97 -0
|
@@ -5386,7 +5386,7 @@ var drawChart = (function (exports) {
|
|
|
5386
5386
|
</script>
|
|
5387
5387
|
<script>
|
|
5388
5388
|
/*<!--*/
|
|
5389
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src","children":[{"uid":"
|
|
5389
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src","children":[{"uid":"da1c61b5-1","name":"lifecycle.ts"},{"uid":"da1c61b5-3","name":"component.ts"},{"uid":"da1c61b5-5","name":"compat-marker.ts"},{"uid":"da1c61b5-7","name":"compat-shared.ts"},{"uid":"da1c61b5-9","name":"context.ts"},{"uid":"da1c61b5-11","name":"dynamic.ts"},{"uid":"da1c61b5-13","name":"telemetry.ts"},{"uid":"da1c61b5-15","name":"error-boundary.ts"},{"uid":"da1c61b5-17","name":"for.ts"},{"uid":"da1c61b5-19","name":"ref.ts"},{"uid":"da1c61b5-21","name":"defer.ts"},{"uid":"da1c61b5-23","name":"lazy.ts"},{"uid":"da1c61b5-25","name":"map-array.ts"},{"uid":"da1c61b5-27","name":"portal.ts"},{"uid":"da1c61b5-29","name":"props.ts"},{"uid":"da1c61b5-31","name":"show.ts"},{"uid":"da1c61b5-33","name":"style.ts"},{"uid":"da1c61b5-35","name":"suspense.ts"},{"uid":"da1c61b5-37","name":"index.ts"}]}]},{"name":"jsx-dev-runtime.js","children":[{"name":"src/jsx-dev-runtime.ts","uid":"da1c61b5-39"}]},{"name":"jsx-runtime.js","children":[{"name":"src/jsx-runtime.ts","uid":"da1c61b5-41"}]},{"name":"_chunks/h-CYSD6aBx.js","children":[{"name":"src/h.ts","uid":"da1c61b5-43"}]}],"isRoot":true},"nodeParts":{"da1c61b5-1":{"renderedLength":3278,"gzipLength":1416,"brotliLength":0,"metaUid":"da1c61b5-0"},"da1c61b5-3":{"renderedLength":1908,"gzipLength":881,"brotliLength":0,"metaUid":"da1c61b5-2"},"da1c61b5-5":{"renderedLength":3173,"gzipLength":1409,"brotliLength":0,"metaUid":"da1c61b5-4"},"da1c61b5-7":{"renderedLength":2346,"gzipLength":1033,"brotliLength":0,"metaUid":"da1c61b5-6"},"da1c61b5-9":{"renderedLength":9041,"gzipLength":3596,"brotliLength":0,"metaUid":"da1c61b5-8"},"da1c61b5-11":{"renderedLength":490,"gzipLength":292,"brotliLength":0,"metaUid":"da1c61b5-10"},"da1c61b5-13":{"renderedLength":1990,"gzipLength":950,"brotliLength":0,"metaUid":"da1c61b5-12"},"da1c61b5-15":{"renderedLength":1666,"gzipLength":843,"brotliLength":0,"metaUid":"da1c61b5-14"},"da1c61b5-17":{"renderedLength":700,"gzipLength":478,"brotliLength":0,"metaUid":"da1c61b5-16"},"da1c61b5-19":{"renderedLength":86,"gzipLength":98,"brotliLength":0,"metaUid":"da1c61b5-18"},"da1c61b5-21":{"renderedLength":4387,"gzipLength":1891,"brotliLength":0,"metaUid":"da1c61b5-20"},"da1c61b5-23":{"renderedLength":461,"gzipLength":273,"brotliLength":0,"metaUid":"da1c61b5-22"},"da1c61b5-25":{"renderedLength":1018,"gzipLength":571,"brotliLength":0,"metaUid":"da1c61b5-24"},"da1c61b5-27":{"renderedLength":818,"gzipLength":491,"brotliLength":0,"metaUid":"da1c61b5-26"},"da1c61b5-29":{"renderedLength":6310,"gzipLength":2344,"brotliLength":0,"metaUid":"da1c61b5-28"},"da1c61b5-31":{"renderedLength":2022,"gzipLength":854,"brotliLength":0,"metaUid":"da1c61b5-30"},"da1c61b5-33":{"renderedLength":1858,"gzipLength":825,"brotliLength":0,"metaUid":"da1c61b5-32"},"da1c61b5-35":{"renderedLength":1104,"gzipLength":614,"brotliLength":0,"metaUid":"da1c61b5-34"},"da1c61b5-37":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"da1c61b5-36"},"da1c61b5-39":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"da1c61b5-38"},"da1c61b5-41":{"renderedLength":1789,"gzipLength":834,"brotliLength":0,"metaUid":"da1c61b5-40"},"da1c61b5-43":{"renderedLength":1813,"gzipLength":957,"brotliLength":0,"metaUid":"da1c61b5-42"}},"nodeMetas":{"da1c61b5-0":{"id":"/src/lifecycle.ts","moduleParts":{"index.js":"da1c61b5-1"},"imported":[],"importedBy":[{"uid":"da1c61b5-36"},{"uid":"da1c61b5-2"},{"uid":"da1c61b5-8"},{"uid":"da1c61b5-14"},{"uid":"da1c61b5-20"}]},"da1c61b5-2":{"id":"/src/component.ts","moduleParts":{"index.js":"da1c61b5-3"},"imported":[{"uid":"da1c61b5-0"}],"importedBy":[{"uid":"da1c61b5-36"},{"uid":"da1c61b5-14"}]},"da1c61b5-4":{"id":"/src/compat-marker.ts","moduleParts":{"index.js":"da1c61b5-5"},"imported":[],"importedBy":[{"uid":"da1c61b5-36"},{"uid":"da1c61b5-14"}]},"da1c61b5-6":{"id":"/src/compat-shared.ts","moduleParts":{"index.js":"da1c61b5-7"},"imported":[],"importedBy":[{"uid":"da1c61b5-36"}]},"da1c61b5-8":{"id":"/src/context.ts","moduleParts":{"index.js":"da1c61b5-9"},"imported":[{"uid":"da1c61b5-44"},{"uid":"da1c61b5-0"}],"importedBy":[{"uid":"da1c61b5-36"}]},"da1c61b5-10":{"id":"/src/dynamic.ts","moduleParts":{"index.js":"da1c61b5-11"},"imported":[{"uid":"da1c61b5-42"}],"importedBy":[{"uid":"da1c61b5-36"}]},"da1c61b5-12":{"id":"/src/telemetry.ts","moduleParts":{"index.js":"da1c61b5-13"},"imported":[{"uid":"da1c61b5-44"}],"importedBy":[{"uid":"da1c61b5-36"},{"uid":"da1c61b5-14"}]},"da1c61b5-14":{"id":"/src/error-boundary.ts","moduleParts":{"index.js":"da1c61b5-15"},"imported":[{"uid":"da1c61b5-44"},{"uid":"da1c61b5-4"},{"uid":"da1c61b5-2"},{"uid":"da1c61b5-0"},{"uid":"da1c61b5-12"}],"importedBy":[{"uid":"da1c61b5-36"}]},"da1c61b5-16":{"id":"/src/for.ts","moduleParts":{"index.js":"da1c61b5-17"},"imported":[],"importedBy":[{"uid":"da1c61b5-36"}]},"da1c61b5-18":{"id":"/src/ref.ts","moduleParts":{"index.js":"da1c61b5-19"},"imported":[],"importedBy":[{"uid":"da1c61b5-36"},{"uid":"da1c61b5-20"}]},"da1c61b5-20":{"id":"/src/defer.ts","moduleParts":{"index.js":"da1c61b5-21"},"imported":[{"uid":"da1c61b5-44"},{"uid":"da1c61b5-42"},{"uid":"da1c61b5-0"},{"uid":"da1c61b5-18"}],"importedBy":[{"uid":"da1c61b5-36"}]},"da1c61b5-22":{"id":"/src/lazy.ts","moduleParts":{"index.js":"da1c61b5-23"},"imported":[{"uid":"da1c61b5-44"},{"uid":"da1c61b5-42"}],"importedBy":[{"uid":"da1c61b5-36"}]},"da1c61b5-24":{"id":"/src/map-array.ts","moduleParts":{"index.js":"da1c61b5-25"},"imported":[],"importedBy":[{"uid":"da1c61b5-36"}]},"da1c61b5-26":{"id":"/src/portal.ts","moduleParts":{"index.js":"da1c61b5-27"},"imported":[],"importedBy":[{"uid":"da1c61b5-36"}]},"da1c61b5-28":{"id":"/src/props.ts","moduleParts":{"index.js":"da1c61b5-29"},"imported":[],"importedBy":[{"uid":"da1c61b5-36"}]},"da1c61b5-30":{"id":"/src/show.ts","moduleParts":{"index.js":"da1c61b5-31"},"imported":[],"importedBy":[{"uid":"da1c61b5-36"}]},"da1c61b5-32":{"id":"/src/style.ts","moduleParts":{"index.js":"da1c61b5-33"},"imported":[],"importedBy":[{"uid":"da1c61b5-36"}]},"da1c61b5-34":{"id":"/src/suspense.ts","moduleParts":{"index.js":"da1c61b5-35"},"imported":[{"uid":"da1c61b5-42"}],"importedBy":[{"uid":"da1c61b5-36"}]},"da1c61b5-36":{"id":"/src/index.ts","moduleParts":{"index.js":"da1c61b5-37"},"imported":[{"uid":"da1c61b5-2"},{"uid":"da1c61b5-4"},{"uid":"da1c61b5-6"},{"uid":"da1c61b5-8"},{"uid":"da1c61b5-10"},{"uid":"da1c61b5-14"},{"uid":"da1c61b5-16"},{"uid":"da1c61b5-42"},{"uid":"da1c61b5-20"},{"uid":"da1c61b5-22"},{"uid":"da1c61b5-0"},{"uid":"da1c61b5-24"},{"uid":"da1c61b5-26"},{"uid":"da1c61b5-28"},{"uid":"da1c61b5-18"},{"uid":"da1c61b5-30"},{"uid":"da1c61b5-32"},{"uid":"da1c61b5-34"},{"uid":"da1c61b5-12"}],"importedBy":[],"isEntry":true},"da1c61b5-38":{"id":"/src/jsx-dev-runtime.ts","moduleParts":{"jsx-dev-runtime.js":"da1c61b5-39"},"imported":[{"uid":"da1c61b5-40"}],"importedBy":[],"isEntry":true},"da1c61b5-40":{"id":"/src/jsx-runtime.ts","moduleParts":{"jsx-runtime.js":"da1c61b5-41"},"imported":[{"uid":"da1c61b5-42"}],"importedBy":[{"uid":"da1c61b5-38"}],"isEntry":true},"da1c61b5-42":{"id":"/src/h.ts","moduleParts":{"_chunks/h-CYSD6aBx.js":"da1c61b5-43"},"imported":[],"importedBy":[{"uid":"da1c61b5-36"},{"uid":"da1c61b5-10"},{"uid":"da1c61b5-20"},{"uid":"da1c61b5-22"},{"uid":"da1c61b5-34"},{"uid":"da1c61b5-40"}]},"da1c61b5-44":{"id":"@pyreon/reactivity","moduleParts":{},"imported":[],"importedBy":[{"uid":"da1c61b5-8"},{"uid":"da1c61b5-14"},{"uid":"da1c61b5-20"},{"uid":"da1c61b5-22"},{"uid":"da1c61b5-12"}]}},"env":{"rollup":"4.23.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
5390
5390
|
|
|
5391
5391
|
const run = () => {
|
|
5392
5392
|
const width = window.innerWidth;
|
package/lib/index.js
CHANGED
|
@@ -23,12 +23,14 @@ function captureCallSite() {
|
|
|
23
23
|
if (!stack) return "";
|
|
24
24
|
const lines = stack.split("\n");
|
|
25
25
|
const skipPatterns = [
|
|
26
|
-
|
|
27
|
-
/\/context\.
|
|
28
|
-
/\/component\.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/\/runtime-server\/src\//,
|
|
26
|
+
/\/lifecycle\.[tj]s/,
|
|
27
|
+
/\/context\.[tj]s/,
|
|
28
|
+
/\/component\.[tj]s/,
|
|
29
|
+
/\bcaptureCallSite\b/,
|
|
30
|
+
/\bwarnOutsideSetup\b/,
|
|
31
|
+
/\/(core|reactivity|runtime-dom|runtime-server|router|head|ui-core|styler|unistyle|rocketstyle|attrs|elements|kinetic)\/src\//,
|
|
32
|
+
/node_modules\/@pyreon\/[^/]+\/lib\//,
|
|
33
|
+
/@pyreon\/[a-z-]+\/lib\//,
|
|
32
34
|
/node:internal/,
|
|
33
35
|
/webpack-internal/,
|
|
34
36
|
/<anonymous>/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/core",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.2",
|
|
4
4
|
"description": "Core component model and lifecycle for Pyreon",
|
|
5
5
|
"homepage": "https://github.com/pyreon/pyreon/tree/main/packages/core#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"prepublishOnly": "bun run build"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@pyreon/reactivity": "^0.24.
|
|
56
|
+
"@pyreon/reactivity": "^0.24.2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@pyreon/manifest": "0.13.1"
|
package/src/lifecycle.ts
CHANGED
|
@@ -34,16 +34,38 @@ function captureCallSite(): string {
|
|
|
34
34
|
const lines = stack.split('\n')
|
|
35
35
|
// Framework paths to skip — conservative, matches the packages that
|
|
36
36
|
// contain lifecycle / provide / context internals and call these hooks.
|
|
37
|
+
// Framework / infra paths + function names to skip. Match BOTH source
|
|
38
|
+
// form (`packages/X/src/...` — workspace consumers via the `bun`
|
|
39
|
+
// condition) AND published-bundle form (`node_modules/@pyreon/X/lib/...`
|
|
40
|
+
// — npm consumers). Pre-fix only the source paths were covered, so
|
|
41
|
+
// every published-package consumer (i.e. almost everyone in production
|
|
42
|
+
// dev) saw the warning's "Called from:" line point at the framework's
|
|
43
|
+
// own bundle code, defeating the user-actionable hint. Function-name
|
|
44
|
+
// patterns (`captureCallSite`, `warnOutsideSetup`) cover the case where
|
|
45
|
+
// bundling rewrites the source path but the symbol name survives.
|
|
37
46
|
const skipPatterns = [
|
|
38
|
-
/
|
|
39
|
-
/\/
|
|
40
|
-
/\/
|
|
41
|
-
/\/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
// ── Source form (workspace / `bun` condition) ──────────────────────
|
|
48
|
+
/\/lifecycle\.[tj]s/,
|
|
49
|
+
/\/context\.[tj]s/,
|
|
50
|
+
/\/component\.[tj]s/,
|
|
51
|
+
// ── Function-name match (works through bundling / minification when
|
|
52
|
+
// symbol names survive) ─────────────────────────────────────────
|
|
53
|
+
/\bcaptureCallSite\b/,
|
|
54
|
+
/\bwarnOutsideSetup\b/,
|
|
55
|
+
// ── Source-tree paths for every framework package that internally
|
|
56
|
+
// calls lifecycle hooks (HeadProvider, RouterProvider, ThemeProvider,
|
|
57
|
+
// PyreonUI, etc.). Without each, a published-package consumer with
|
|
58
|
+
// `useHead()` or `provide()` would see the "Called from:" line
|
|
59
|
+
// point at the LIBRARY's source, not their own component. ───────
|
|
60
|
+
/\/(core|reactivity|runtime-dom|runtime-server|router|head|ui-core|styler|unistyle|rocketstyle|attrs|elements|kinetic)\/src\//,
|
|
61
|
+
// ── Published-bundle form (npm consumers): bundles always at
|
|
62
|
+
// `node_modules/@pyreon/<name>/lib/...`. The blanket
|
|
63
|
+
// `@pyreon/[a-z-]+/lib/` catches every package without per-name
|
|
64
|
+
// maintenance. ────────────────────────────────────────────────────
|
|
65
|
+
/node_modules\/@pyreon\/[^/]+\/lib\//,
|
|
66
|
+
/@pyreon\/[a-z-]+\/lib\//,
|
|
67
|
+
// ── Runtime / engine internals ─────────────────────────────────────
|
|
45
68
|
/node:internal/,
|
|
46
|
-
// chrome devtools source mappings
|
|
47
69
|
/webpack-internal/,
|
|
48
70
|
/<anonymous>/,
|
|
49
71
|
]
|
|
@@ -251,3 +251,100 @@ describe('warnOutsideSetup — call-site capture', () => {
|
|
|
251
251
|
warnSpy.mockRestore()
|
|
252
252
|
})
|
|
253
253
|
})
|
|
254
|
+
|
|
255
|
+
describe('captureCallSite — skip patterns cover published-bundle paths', () => {
|
|
256
|
+
// Real bug surfaced from a 0.24.1 consumer report: the pre-fix patterns
|
|
257
|
+
// only matched source-tree paths (`/lifecycle\.ts/`, `/core\/src\//`,
|
|
258
|
+
// etc.). Published packages bundle to `node_modules/@pyreon/<name>/lib/`,
|
|
259
|
+
// so the framework's own stack frames slipped through the filter — the
|
|
260
|
+
// warning's "Called from:" line pointed at the warning emitter itself
|
|
261
|
+
// (or the framework's lib code) instead of the user's call site.
|
|
262
|
+
//
|
|
263
|
+
// We can't easily synthesise a real published-bundle stack in a test,
|
|
264
|
+
// but we CAN exercise the regex set directly. The fix added matchers
|
|
265
|
+
// for `@pyreon/<name>/lib/` paths AND function-name matches
|
|
266
|
+
// (`captureCallSite`, `warnOutsideSetup`) that survive bundling.
|
|
267
|
+
|
|
268
|
+
// Mirror the patterns from the impl. (If this list drifts, the impl
|
|
269
|
+
// and this test fall out of sync — that's the regression signal.)
|
|
270
|
+
const skipPatterns = [
|
|
271
|
+
/\/lifecycle\.[tj]s/,
|
|
272
|
+
/\/context\.[tj]s/,
|
|
273
|
+
/\/component\.[tj]s/,
|
|
274
|
+
/\bcaptureCallSite\b/,
|
|
275
|
+
/\bwarnOutsideSetup\b/,
|
|
276
|
+
/\/(core|reactivity|runtime-dom|runtime-server|router|head|ui-core|styler|unistyle|rocketstyle|attrs|elements|kinetic)\/src\//,
|
|
277
|
+
/node_modules\/@pyreon\/[^/]+\/lib\//,
|
|
278
|
+
/@pyreon\/[a-z-]+\/lib\//,
|
|
279
|
+
/node:internal/,
|
|
280
|
+
/webpack-internal/,
|
|
281
|
+
/<anonymous>/,
|
|
282
|
+
]
|
|
283
|
+
|
|
284
|
+
const isSkipped = (line: string): boolean =>
|
|
285
|
+
skipPatterns.some((p) => p.test(line))
|
|
286
|
+
|
|
287
|
+
test('skips published-bundle lib paths (`@pyreon/X/lib/`)', () => {
|
|
288
|
+
expect(
|
|
289
|
+
isSkipped(
|
|
290
|
+
'at HeadProvider (file:///app/node_modules/@pyreon/head/lib/index.js:42:7)',
|
|
291
|
+
),
|
|
292
|
+
).toBe(true)
|
|
293
|
+
expect(
|
|
294
|
+
isSkipped(
|
|
295
|
+
'at provide (file:///app/node_modules/@pyreon/core/lib/index.js:96:5)',
|
|
296
|
+
),
|
|
297
|
+
).toBe(true)
|
|
298
|
+
expect(
|
|
299
|
+
isSkipped(
|
|
300
|
+
'at ThemeProvider (file:///app/node_modules/@pyreon/styler/lib/index.js:24:3)',
|
|
301
|
+
),
|
|
302
|
+
).toBe(true)
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
test('skips workspace source paths (`bun` condition consumers)', () => {
|
|
306
|
+
expect(
|
|
307
|
+
isSkipped(
|
|
308
|
+
'at provide (/Users/me/proj/packages/core/core/src/context.ts:88:3)',
|
|
309
|
+
),
|
|
310
|
+
).toBe(true)
|
|
311
|
+
expect(
|
|
312
|
+
isSkipped('at HeadProvider (/Users/me/proj/packages/core/head/src/provider.ts:56:5)'),
|
|
313
|
+
).toBe(true)
|
|
314
|
+
expect(
|
|
315
|
+
isSkipped(
|
|
316
|
+
'at RouterProvider (/Users/me/proj/packages/core/router/src/components.tsx:30:5)',
|
|
317
|
+
),
|
|
318
|
+
).toBe(true)
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
test('skips the warning infrastructure itself (function-name match)', () => {
|
|
322
|
+
// Even if the file path is mangled (minified / bundled to a single
|
|
323
|
+
// file like `lib/index.js`), the symbol names survive when bundlers
|
|
324
|
+
// preserve exports. The function-name pattern catches both.
|
|
325
|
+
expect(isSkipped('at captureCallSite (lib/index.js:22:33)')).toBe(true)
|
|
326
|
+
expect(isSkipped('at warnOutsideSetup (lib/index.js:55:21)')).toBe(true)
|
|
327
|
+
expect(isSkipped(' at captureCallSite (mangled-bundle.js:9999:11)')).toBe(true)
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
test('skips engine / anonymous frames', () => {
|
|
331
|
+
expect(isSkipped('at <anonymous>')).toBe(true)
|
|
332
|
+
expect(isSkipped('at runMicrotasks (node:internal/process/task_queues:96:5)')).toBe(true)
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
test('does NOT skip user-code paths in src/ or pages/ etc.', () => {
|
|
336
|
+
// These should ALL fall through the skip filter so captureCallSite
|
|
337
|
+
// returns them as the "Called from:" line — the user-actionable hint.
|
|
338
|
+
expect(isSkipped('at MyComponent (/Users/me/proj/src/components/Foo.tsx:42:15)')).toBe(false)
|
|
339
|
+
expect(isSkipped('at HomePage (/Users/me/proj/src/pages/Home.tsx:10:5)')).toBe(false)
|
|
340
|
+
expect(isSkipped('at NotFound (/Users/me/proj/src/routes/_not-found.tsx:5:7)')).toBe(false)
|
|
341
|
+
})
|
|
342
|
+
|
|
343
|
+
test('does NOT skip user code that happens to be in node_modules but NOT @pyreon/', () => {
|
|
344
|
+
// A user-installed third-party package's component shouldn't be
|
|
345
|
+
// skipped — only `@pyreon/*` framework bundles are silenced.
|
|
346
|
+
expect(
|
|
347
|
+
isSkipped('at SomeLib (file:///app/node_modules/some-third-party/lib/index.js:42:7)'),
|
|
348
|
+
).toBe(false)
|
|
349
|
+
})
|
|
350
|
+
})
|