V6#1570
Conversation
There was a problem hiding this comment.
Pull request overview
This PR appears to be a broad “V6” refactor/re-organization of the iframe-resizer monorepo, splitting previously monolithic logic into smaller modules across @iframe-resizer/core and @iframe-resizer/child, while also adding/adjusting parent-side initialization behavior (including disconnected iframes), updating warnings/messages, and bumping package versions/build artifacts.
Changes:
- Refactors
packages/coreinto many focused modules (setup, routing, send/receive, monitors, methods, checks, events). - Refactors/adds substantial new
packages/childmodule structure (init flow, observers, sizing, public methods, message handling). - Adds parent factory behavior for disconnected iframes + tests, updates warnings, bumps version/build metadata.
Reviewed changes
Copilot reviewed 136 out of 136 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/childSpec.js | Updates expected warning text for unexpected messages. |
| packages/parent/factory.test.js | Adds Jest coverage for connected vs disconnected iframe initialization and error cases. |
| packages/parent/factory.js | Defers initialization for disconnected iframes via MutationObserver; adds document.body guard. |
| packages/core/values/defaults.js | Minor formatting change in defaults object. |
| packages/core/setup/update-option-names.js | Adds option rename/deprecation handling (e.g., offset -> offsetSize). |
| packages/core/setup/target-origin.js | Introduces targetOrigin calculation and postMessageTarget initialization helpers. |
| packages/core/setup/scrolling.js | Extracts scrolling/overflow setup into dedicated module. |
| packages/core/setup/process-options.js | Centralizes options processing + calls into setup helpers (direction, offsets, logging, etc.). |
| packages/core/setup/logging.js | Extracts logging initialization/validation into dedicated module. |
| packages/core/setup/init.js | Extracts init triggering + load listener behavior into dedicated module. |
| packages/core/setup/index.js | New setup orchestration entrypoint for core iframe setup sequence. |
| packages/core/setup/first-run.js | Extracts first-run behavior (mode check + flag update). |
| packages/core/setup/direction.js | Extracts direction handling and validates direction values. |
| packages/core/setup/body-margin.js | Extracts body margin normalization logic. |
| packages/core/send/trigger.js | Extracts message dispatch logic (same-origin fallback to postMessage). |
| packages/core/send/timeout.test.js | Fixes import paths/mocking for timeout tests after refactor. |
| packages/core/send/timeout.js | Adjusts imports and keeps no-response warning timer logic. |
| packages/core/send/ready.js | Adds handler for child “ready” message to re-trigger init where appropriate. |
| packages/core/send/outgoing.js | Extracts outgoing init payload creation logic. |
| packages/core/send/offset.js | Adds offsetSize/offset handling to populate offsetHeight/offsetWidth based on direction. |
| packages/core/router.js | Extracts message routing switch (resize/close/scroll/title/etc.). |
| packages/core/received/preflight.js | Adds preflight checks (iframe exists, origin allowed, meta-parent filtering, message-for-us). |
| packages/core/received/message.js | Extracts helper for slicing message bodies from lastMessage. |
| packages/core/received/decode.js | Extracts message decoding + computed-style padding/border adjustments. |
| packages/core/page/title.js | Extracts title sync checks + setter. |
| packages/core/page/scroll.js | Extracts scrollBy/scrollTo/scrollToOffset logic. |
| packages/core/page/position.js | Extracts storing/restoring page scroll position. |
| packages/core/page/in-page-link.js | Extracts in-page-link handling and parent delegation behavior. |
| packages/core/monitor/props.js | Adds parent viewport/document/iframe props monitor payload. |
| packages/core/monitor/page-info.js | Adds page info payload generation for child consumption. |
| packages/core/monitor/common.js | Adds shared monitor start/stop + throttled trigger logic. |
| packages/core/methods/reset.js | Extracts reset behavior (store position, set size, send RESET). |
| packages/core/methods/disconnect.js | Extracts disconnect behavior (remove settings + API object). |
| packages/core/methods/close.js | Extracts close/remove logic with onBeforeClose/onAfterClose integration. |
| packages/core/methods/attach.js | Attaches public API methods onto the iframe element (close/disconnect/sendMessage/etc.). |
| packages/core/listeners.js | Extracts global message/visibility listeners and same-origin listener shim. |
| packages/core/index.js | Replaces large monolith with a small connectResizer entry that wires setup + listeners + logging. |
| packages/core/events/wrapper.js | Extracts event-callback invocation logic and error handling. |
| packages/core/events/visible.js | Extracts “tab visible” handling that triggers resize. |
| packages/core/events/size.js | Extracts iframe dimension setting logic. |
| packages/core/events/resize.js | Extracts resize handling (set size, restore page position, onResized). |
| packages/core/events/mouse.js | Extracts mouse enter/leave message handling and callback dispatch. |
| packages/core/events/message.js | Extracts onMessage payload parsing + callback dispatch. |
| packages/core/checks/warning-timeout.js | Extracts warningTimeout validation/logging. |
| packages/core/checks/version.js | Extracts parent-side child version mismatch + legacy detection messages. |
| packages/core/checks/unique.js | Fixes import paths for unique-id check after refactor. |
| packages/core/checks/origin.js | Extracts same-origin capability detection. |
| packages/core/checks/options.js | Extracts deprecated options warning (sizeWidth/sizeHeight/autoResize -> direction). |
| packages/core/checks/mode.js | Extracts vInfo/mode enforcement + preModeCheck + vInfo disabling. |
| packages/core/checks/manual-logging.js | Extracts querystring-based log enabling (ifrlog). |
| packages/core/checks/id.js | Extracts iframe id assignment/validation. |
| packages/common/utils.js | Adds isObject and isIframe helpers; adjusts imports. |
| packages/common/mode.js | Updates mode key parsing and mapping logic (adds new key + adjusted mapping). |
| packages/common/consts.js | Removes AFTER_EVENT_STACK; adds calc-mode defaults + EVENT_CANCEL_TIMER; other const changes. |
| packages/child/values/state.js | Introduces centralized child runtime state container. |
| packages/child/values/settings.js | Introduces centralized child settings defaults and hooks. |
| packages/child/utils/map-settings.js | Adds helper to map defined values onto settings. |
| packages/child/utils/isolate.js | Adds child-side isolation for setup steps with reporting behavior. |
| packages/child/size/max-element.js | Adds max-element sizing strategy with perf marks/logging. |
| packages/child/size/index.js | Exposes child size getters. |
| packages/child/size/get-width.js | Adds width calculation modes and defaults. |
| packages/child/size/get-new.js | Adds new-size computation including onBeforeResize validation. |
| packages/child/size/get-height.js | Adds height calculation modes and defaults. |
| packages/child/size/custom.js | Adds deprecated custom calc-method support + maps to onBeforeResize guidance. |
| packages/child/size/content.js | Adds content size calculation + change detection routing. |
| packages/child/size/change-detected.js | Adds tolerance-based size change detection logic. |
| packages/child/size/body-offset.js | Extracts V1-compatible body-offset calculation. |
| packages/child/size/auto.js | Implements auto sizing heuristics across scroll/bounding/tagged/overflow states. |
| packages/child/size/all.js | Adds element enumeration and measurement collection utilities. |
| packages/child/send/title.js | Adds child-to-parent title sync sender. |
| packages/child/send/size.js | Adds child-side debounced/RAF-gated size send pipeline. |
| packages/child/send/message.js | Adds generic message sender wrapper around dispatch. |
| packages/child/send/dispatch.js | Implements same-origin/postMessage dispatch, timing logs, and targetOrigin selection. |
| packages/child/received/utils.js | Adds parsing helpers and message-type detection utilities. |
| packages/child/received/resize.js | Adds handling for parent-requested resize checks. |
| packages/child/received/reset.js | Adds child reset handling guarded by initLock. |
| packages/child/received/process-request.js | Adds message-type router mapping to handlers. |
| packages/child/received/parent-info.js | Adds parent-info handler + callback dispatch / stop message. |
| packages/child/received/page-info.js | Adds page-info handler + callback dispatch / stop message. |
| packages/child/received/message.js | Adds onMessage handler parsing JSON and dispatching to page handler. |
| packages/child/received/is.js | Adds message-for-us checks + init-message detection + middle-tier detection. |
| packages/child/received/init.js | Adds init-from-parent handler with readyState + initLock timing. |
| packages/child/received/index.js | Adds child-side message receiver with unexpected-message warnings. |
| packages/child/read/from-parent.js | Adds parsing of parent init payload into typed settings. |
| packages/child/read/from-page.js | Adds page-global config reader with validation and deprecations. |
| packages/child/read.test.js | Removes old read utility tests (file deleted). |
| packages/child/read.js | Removes old read utility module (file deleted). |
| packages/child/page/stop-infinite-resizing.js | Adds CSS changes to prevent infinite resizing feedback loops. |
| packages/child/page/reset.js | Adds reset trigger logic with trigger lock and calc-mode reset behavior. |
| packages/child/page/links.js | Adds in-page link interception and parent scroll delegation. |
| packages/child/page/css.js | Adds safe body CSS setters with negative-value guard. |
| packages/child/page/clear-fix.js | Adds clearfix injector for layout stabilization. |
| packages/child/page/apply-selectors.js | Adds apply selector-based attributes for size/ignore behavior. |
| packages/child/observers/perf.js | Removes commented dead code; keeps perf observer. |
| packages/child/observers/overflow.js | Uses NONE const for display comparison; import adjustments. |
| packages/child/observed/visibility.js | Adds visibility observer reaction that triggers sizing. |
| packages/child/observed/resize.js | Adds observed resize handler wiring into size sending. |
| packages/child/observed/overflow.js | Adds observed overflow handler wiring into size sending. |
| packages/child/observed/observers.js | Adds shared observers registry object. |
| packages/child/observed/mutation.js | Adds mutation handling that updates selectors/tags/overflow and adjusts observers. |
| packages/child/observed/index.js | Wires up mutation/overflow/perf/resize/visibility observers and teardown handling. |
| packages/child/methods/send-message.js | Adds public API method for sending message to parent with optional targetOrigin. |
| packages/child/methods/scroll.js | Adds public scrollBy/scrollTo/scrollToOffset APIs with type assertions. |
| packages/child/methods/resize.js | Adds public resize API with optional custom size overrides and validation. |
| packages/child/methods/proxy.js | Adds deprecation proxy for window.parentIFrame -> window.parentIframe. |
| packages/child/methods/parent-props.js | Adds getParentProps + deprecated alias getParentProperties. |
| packages/child/methods/page-info.js | Adds deprecated getPageInfo behavior mapping to new APIs. |
| packages/child/methods/origin.js | Adds getOrigin deprecation + getParentOrigin + setTargetOrigin. |
| packages/child/methods/offset-size.js | Adds setOffsetSize API that triggers a size send. |
| packages/child/methods/move-to-anchor.js | Adds moveToAnchor API to invoke in-page link behavior. |
| packages/child/methods/index.js | Defines and installs frozen window.parentIframe API surface + deprecated proxy parentIFrame. |
| packages/child/methods/calculation-methods.js | Adds setters for calculation method modes with validation calls. |
| packages/child/methods/auto-resize.js | Adds runtime autoResize toggling with mode checks and messaging. |
| packages/child/init.js | Adds new child init orchestration (read settings, setup observers/methods, send INIT + TITLE). |
| packages/child/from-string.test.js | Removes old from-string tests (file deleted). |
| packages/child/from-string.js | Removes old from-string helpers (file deleted). |
| packages/child/events/ready.js | Adds child “ready” signaling for async-loaded child script. |
| packages/child/events/print.js | Adds beforeprint/afterprint listeners that trigger sizing. |
| packages/child/events/page-hide.js | Adds pagehide handling and teardown execution. |
| packages/child/events/mouse.js | Adds mouse enter/leave forwarding to parent. |
| packages/child/events/listeners.js | Fixes import path for console log after refactor. |
| packages/child/check/version.js | Adds child-side parent version/legacy detection messages. |
| packages/child/check/tolerance.js | Adds tolerance comparison helper. |
| packages/child/check/tags.js | Adds tagged-element detection for sizing. |
| packages/child/check/settings.js | Adds child-side settings logging/validation messaging. |
| packages/child/check/ready.js | Adds readyState polling/listening helper for init completion. |
| packages/child/check/quirks-mode.js | Adds Quirks Mode warning. |
| packages/child/check/overflow.js | Adds overflow detection, ignored-element filtering, and update detection logic. |
| packages/child/check/mode.js | Adds mode/license/key enforcement and vInfo behavior for child. |
| packages/child/check/ignored-elements.js | Adds logging for [data-iframe-ignore] usage. |
| packages/child/check/deprecated-attributes.js | Adds migration from deprecated size attrs to data-iframe-size. |
| packages/child/check/cross-domain.js | Adds cross-domain detection for same-origin optimization. |
| packages/child/check/calculation-mode.js | Adds calc-mode validation + deprecation warnings. |
| packages/child/check/both.js | Adds helper to detect both-direction mode. |
| packages/child/check/blocking-css.js | Fixes imports and uses NONE const for CSS checks. |
| packages/angular/directive.ts | Extends direction union type to include 'both'. |
| package.json | Bumps version and updates several dependency versions. |
| js-dist/iframe-resizer.jquery.js | Updates built artifact banner/version and bundled code. |
| build/banner.js | Updates banner formatting and license text. |
| .ncurc.json | Adds eslint-plugin-react-refresh to allowed upgrade list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@davidjbradshaw I've opened a new pull request, #1571, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@davidjbradshaw I've opened a new pull request, #1572, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@davidjbradshaw I've opened a new pull request, #1573, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@copilot can we please update the Jasmine/karma testing to the latest version and fix all the disabled tests. These are for integration testing, so it is ok to use more mocks, rather than to try and create iframes, which can be unreliable and doesn't work in CI. Once you have this working can you also create a GitHub action for these as well. |
|
@davidjbradshaw I've opened a new pull request, #1584, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@copilot can you please ensure all GitHub Actions run on this branch |
|
@davidjbradshaw I've opened a new pull request, #1585, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@copilot we have a failing test |
|
@davidjbradshaw I've opened a new pull request, #1586, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@copilot I have just followed the manual merge steps, so why for the love of god it merging still blocked??? |
|
@davidjbradshaw I've opened a new pull request, #1588, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@copilot I have just followed these steps Why is this unchanged??? I have just spent two hours resolving them, it is time to allow me to do the merge. |
|
@davidjbradshaw I've opened a new pull request, #1589, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@copilot can you please push on and add unit tests for the uncovered lines in the project. If you think it is unreasonable to test a particular bit of code, please let me know your reasons. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 159 out of 624 changed files in this pull request and generated 1 comment.
Files not reviewed (9)
- e2e/apps/alpine/package-lock.json: Language not supported
- e2e/apps/react/package-lock.json: Language not supported
- e2e/apps/solid/package-lock.json: Language not supported
- e2e/apps/svelte/package-lock.json: Language not supported
- e2e/apps/vue/package-lock.json: Language not supported
- e2e/apps/web-component/package-lock.json: Language not supported
- example/alpine/package-lock.json: Language not supported
- example/solid/package-lock.json: Language not supported
- example/svelte/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| ## Build System | ||
|
|
||
| Despite the filename, `vite.config.js` is a **Rollup** configuration driven programmatically by `vite-build.js`. |
There was a problem hiding this comment.
This build-system section appears out of sync with the new build scripts introduced in this PR (e.g., build-scripts/build-all.js, build-browser.js, etc.) and the repo-level notes elsewhere that treat vite-build.js as obsolete. Update this section to reflect the new build entrypoints and current scripts to avoid misguiding contributors.
| Despite the filename, `vite.config.js` is a **Rollup** configuration driven programmatically by `vite-build.js`. | |
| `vite.config.js` is the shared Vite/Rollup configuration used by the current build scripts. Build orchestration now goes through the newer entrypoints (for example `build-scripts/build-all.js` and `build-browser.js`), and `vite-build.js` should be treated as obsolete. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 159 out of 624 changed files in this pull request and generated 2 comments.
Files not reviewed (9)
- e2e/apps/alpine/package-lock.json: Language not supported
- e2e/apps/react/package-lock.json: Language not supported
- e2e/apps/solid/package-lock.json: Language not supported
- e2e/apps/svelte/package-lock.json: Language not supported
- e2e/apps/vue/package-lock.json: Language not supported
- e2e/apps/web-component/package-lock.json: Language not supported
- example/alpine/package-lock.json: Language not supported
- example/solid/package-lock.json: Language not supported
- example/svelte/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)
example/html/child/frame.content.html:1
- Same issue as the shared child page: document.body.lastChild is not guaranteed to be an Element, so .append(div) may throw. Prefer document.body.append(div) or lastElementChild to avoid runtime errors in the example.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ## Build System | ||
|
|
||
| Despite the filename, `vite.config.js` is a **Rollup** configuration driven programmatically by `vite-build.js`. |
There was a problem hiding this comment.
This guidance appears inconsistent with the new build scripts added in this PR (e.g., build-scripts/build-all.js and the move toward per-package configs). Update this section to reflect the current build entrypoints and outputs (and remove references to vite-build.js / old behavior if those files are now deprecated/ignored).
| data.message ? ( | ||
| 'message' in data ? ( | ||
| <span> | ||
| <b>Frame ID:</b> {data.iframe.id} <br/> |
There was a problem hiding this comment.
In JSX,
is valid, but many React/JSX lint configurations enforce a space before the slash (
). If the repo’s ESLint rules include react/jsx-tag-spacing or formatting rules, this may fail linting—consider normalizing to
.
Reformat license text for better readability.
|
@copilot apply changes based on the comments in this thread |
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add a `beforeAll` warmup that runs a valid GPLv3 init so the module-level `vAdvised` flag in `checkMode` is set before the invalid/missing-license tests run. Without this, an invalid-license test running first would throw in `checkMode` and prevent `onReady` from firing, timing the test out. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Iframe-Resizer v6.0.0
Native TypeScript
New Features
<title/>and update parentpostMessagefor local iframes.getVersion() : { parent, child }onBeforeResize(newSize, event, direction)Platforms
New Platforms
Tests
Fixes
targetOrigindata-iframe-size->data-iframe-resize(old version will auto convert)sizeSelectpr->resizeSelectorinPageLinksis false now throws.Type Deprecations
Legacy options still in code, but removed from documentation.
close()on parent (usedisconnect()bodyColorbodyMarginbodyPaddingwaitForLoad- no longer required in modern browsersReact.getElement()- non-standard APIChore
iFrameResizerreferences, useiframeResizerinstead