Update root JS dependencies

This commit is contained in:
Hugo Alliaume
2026-01-11 00:13:28 +01:00
parent e415a23c6b
commit 91d1bb7215
40 changed files with 1382 additions and 858 deletions

View File

@@ -70,7 +70,7 @@ async function main() {
external: Array.from(external),
format: 'esm',
platform: 'browser',
tsconfig: path.join(import.meta.dirname, '../tsconfig.packages.json'),
tsconfig: path.join(packageRoot, 'tsconfig.json'),
dts: {
entry: inputFiles.filter(inputFile => !inputFile.endsWith('.css')),
},

View File

@@ -15,16 +15,16 @@
"ci": "biome ci"
},
"devDependencies": {
"@biomejs/biome": "^2.0.4",
"@playwright/test": "^1.54.2",
"@puppeteer/browsers": "^2.10.6",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@types/node": "^22.6.0",
"lightningcss": "^1.28.2",
"pkg-types": "^2.2.0",
"tinyglobby": "^0.2.14",
"tsup": "^8.5.0",
"@biomejs/biome": "^2.3.11",
"@playwright/test": "^1.57.0",
"@puppeteer/browsers": "^2.11.0",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
"@types/node": "^22.19.3",
"lightningcss": "^1.30.2",
"pkg-types": "^2.3.0",
"tinyglobby": "^0.2.15",
"tsup": "^8.5.1",
"vitest": "^3.2.4"
}
}

1990
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -667,7 +667,7 @@ describe('AutocompleteController', () => {
if (null === newTomSelect) {
throw new Error('Missing TomSelect instance');
}
// @ts-ignore
// @ts-expect-error
newTomSelect.addItem('7');
expect(selectElement.value).toBe('7');
@@ -798,7 +798,7 @@ describe('AutocompleteController', () => {
if (null === newTomSelect) {
throw new Error('Missing TomSelect instance');
}
// @ts-ignore
// @ts-expect-error
expect(newTomSelect.control_input.placeholder).toBe('Select a cat');
});

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -545,12 +545,14 @@ var HookManager_default = class {
}
triggerHook(hookName, ...args) {
const hooks = this.hooks.get(hookName) || [];
hooks.forEach((callback) => callback(...args));
hooks.forEach((callback) => {
callback(...args);
});
}
};
// ../../../node_modules/.pnpm/idiomorph@0.3.0/node_modules/idiomorph/dist/idiomorph.esm.js
var Idiomorph = function() {
var Idiomorph = (function() {
"use strict";
let EMPTY_SET = /* @__PURE__ */ new Set();
let defaults = {
@@ -1093,7 +1095,7 @@ var Idiomorph = function() {
morph,
defaults
};
}();
})();
// src/normalize_attributes_for_comparison.ts
function normalizeAttributesForComparison(element) {

View File

@@ -588,7 +588,7 @@ export function proxifyComponent(component: Component): Component {
set(target: Component, property: string, value: any): boolean {
if (property in target) {
// @ts-ignore Ignoring potentially setting private properties
// @ts-expect-error Ignoring potentially setting private properties
target[property as keyof typeof target] = value;
return true;

View File

@@ -31,6 +31,8 @@ export default class {
...args: Parameters<ComponentHookCallback<T>>
): void {
const hooks = this.hooks.get(hookName) || [];
hooks.forEach((callback) => callback(...args));
hooks.forEach((callback) => {
callback(...args);
});
}
}

View File

@@ -1,4 +1,4 @@
// @ts-ignore
// @ts-expect-error
import { Idiomorph } from 'idiomorph/dist/idiomorph.esm.js';
import { cloneHTMLElement, getModelDirectiveFromElement, setValueOnElement } from './dom_utils';
import { normalizeAttributesForComparison } from './normalize_attributes_for_comparison';
@@ -121,23 +121,23 @@ export function executeMorphdom(
// We assume fromEl is an Alpine component if it has `__x` property.
// If it's the case, then we should morph `fromEl` to `ToEl` (thanks to https://alpinejs.dev/plugins/morph)
// in order to keep the component state and UI in sync.
// @ts-ignore
// @ts-expect-error
if (typeof fromEl.__x !== 'undefined') {
// @ts-ignore
// @ts-expect-error
if (!window.Alpine) {
throw new Error(
'Unable to access Alpine.js though the global window.Alpine variable. Please make sure Alpine.js is loaded before Symfony UX LiveComponent.'
);
}
// @ts-ignore
// @ts-expect-error
if (typeof window.Alpine.morph !== 'function') {
throw new Error(
'Unable to access Alpine.js morph function. Please make sure the Alpine.js Morph plugin is installed and loaded, see https://alpinejs.dev/plugins/morph for more information.'
);
}
// @ts-ignore
// @ts-expect-error
window.Alpine.morph(fromEl.__x, toEl);
}

View File

@@ -242,7 +242,6 @@ class MockedAjaxCall {
// this should be a simple, top-level property update
if (null !== this.expectedUpdatedPropsFromParent) {
Object.keys(this.expectedUpdatedPropsFromParent).forEach((key) => {
// @ts-ignore
newProps[key] = this.expectedUpdatedPropsFromParent[key];
});
}
@@ -292,7 +291,7 @@ class MockedAjaxCall {
});
return new BackendRequest(
// @ts-ignore Response doesn't quite match the underlying interface
// @ts-expect-error Response doesn't quite match the underlying interface
promise,
this.expectedActions.map((action) => action.name),
Object.keys(this.expectedSentUpdatedData)
@@ -491,7 +490,7 @@ export function getComponent(element: HTMLElement | null) {
throw new Error('could not find element');
}
// @ts-ignore
// @ts-expect-error
const component = element.__component;
if (!(component instanceof Component)) {
throw new Error('missing component');

View File

@@ -202,10 +202,10 @@ describe('buildRequest', () => {
// Helper method for FileList mocking
const getFileList = (length = 1) => {
const blob = new Blob([''], { type: 'text/html' });
// @ts-ignore This is a mock and those are needed to mock a File object
// @ts-expect-error This is a mock and those are needed to mock a File object
// biome-ignore lint/complexity/useLiteralKeys: This is a mock and those are needed to mock a File object
blob['lastModifiedDate'] = '';
// @ts-ignore This is a mock and those are needed to mock a File object
// @ts-expect-error This is a mock and those are needed to mock a File object
// biome-ignore lint/complexity/useLiteralKeys: This is a mock and those are needed to mock a File object
blob['name'] = 'filename';
const file = <File>blob;

View File

@@ -18,7 +18,7 @@ const makeTestComponent = (): { component: Component; backend: MockBackend } =>
this.actions = actions;
return new BackendRequest(
// @ts-ignore Response doesn't quite match the underlying interface
// @ts-expect-error Response doesn't quite match the underlying interface
new Promise((resolve) => resolve(new Response('<div data-live-props-value="{}"></div>'))),
[],
[]
@@ -63,7 +63,7 @@ describe('Component class', () => {
// it's still not *instantly* resolve - it'll
expect(backendResponse).toBeNull();
await waitFor(() => expect(backendResponse).not.toBeNull());
// @ts-ignore
// @ts-expect-error
expect(await backendResponse?.getBody()).toEqual('<div data-live-props-value="{}"></div>');
});
@@ -107,20 +107,20 @@ describe('Component class', () => {
it('calls get() on the component', () => {
const { proxy } = makeDummyComponent();
proxy.set('firstName', 'Ryan');
// @ts-ignore
// @ts-expect-error
expect(proxy.firstName).toBe('Ryan');
});
it('calls set() on the component', () => {
const { proxy } = makeDummyComponent();
// @ts-ignore
// @ts-expect-error
proxy.firstName = 'Ryan';
expect(proxy.getData('firstName')).toBe('Ryan');
});
it('calls an action on a component', async () => {
const { proxy, backend } = makeDummyComponent();
// @ts-ignore
// @ts-expect-error
proxy.save({ foo: 'bar', secondArg: 'secondValue' });
// ugly: the action delays for 0ms, so we just need a TINy

View File

@@ -10,7 +10,7 @@ const createComponent = (element: HTMLElement, name = 'foo-component'): Componen
const backend: BackendInterface = {
makeRequest(): BackendRequest {
return new BackendRequest(
// @ts-ignore Response doesn't quite match the underlying interface
// @ts-expect-error Response doesn't quite match the underlying interface
new Promise((resolve) => resolve(new Response(''))),
[],
[]

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -33,11 +33,21 @@ var abstract_map_controller_default = class extends Controller {
this.createCircle = this.createDrawingFactory("circle", this.circles, this.doCreateCircle.bind(this));
this.createRectangle = this.createDrawingFactory("rectangle", this.rectangles, this.doCreateRectangle.bind(this));
this.map = this.doCreateMap({ definition: mapDefinition });
this.markersValue.forEach((definition) => this.createMarker({ definition }));
this.polygonsValue.forEach((definition) => this.createPolygon({ definition }));
this.polylinesValue.forEach((definition) => this.createPolyline({ definition }));
this.circlesValue.forEach((definition) => this.createCircle({ definition }));
this.rectanglesValue.forEach((definition) => this.createRectangle({ definition }));
this.markersValue.forEach((definition) => {
this.createMarker({ definition });
});
this.polygonsValue.forEach((definition) => {
this.createPolygon({ definition });
});
this.polylinesValue.forEach((definition) => {
this.createPolyline({ definition });
});
this.circlesValue.forEach((definition) => {
this.createCircle({ definition });
});
this.rectanglesValue.forEach((definition) => {
this.createRectangle({ definition });
});
if (this.fitBoundsToMarkersValue) {
this.doFitBoundsToMarkers();
}

View File

@@ -309,11 +309,21 @@ export default abstract class<
this.createRectangle = this.createDrawingFactory('rectangle', this.rectangles, this.doCreateRectangle.bind(this));
this.map = this.doCreateMap({ definition: mapDefinition });
this.markersValue.forEach((definition) => this.createMarker({ definition }));
this.polygonsValue.forEach((definition) => this.createPolygon({ definition }));
this.polylinesValue.forEach((definition) => this.createPolyline({ definition }));
this.circlesValue.forEach((definition) => this.createCircle({ definition }));
this.rectanglesValue.forEach((definition) => this.createRectangle({ definition }));
this.markersValue.forEach((definition) => {
this.createMarker({ definition });
});
this.polygonsValue.forEach((definition) => {
this.createPolygon({ definition });
});
this.polylinesValue.forEach((definition) => {
this.createPolyline({ definition });
});
this.circlesValue.forEach((definition) => {
this.createCircle({ definition });
});
this.rectanglesValue.forEach((definition) => {
this.createRectangle({ definition });
});
if (this.fitBoundsToMarkersValue) {
this.doFitBoundsToMarkers();

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -36,11 +36,21 @@ var abstract_map_controller_default = class extends Controller {
this.createCircle = this.createDrawingFactory("circle", this.circles, this.doCreateCircle.bind(this));
this.createRectangle = this.createDrawingFactory("rectangle", this.rectangles, this.doCreateRectangle.bind(this));
this.map = this.doCreateMap({ definition: mapDefinition });
this.markersValue.forEach((definition) => this.createMarker({ definition }));
this.polygonsValue.forEach((definition) => this.createPolygon({ definition }));
this.polylinesValue.forEach((definition) => this.createPolyline({ definition }));
this.circlesValue.forEach((definition) => this.createCircle({ definition }));
this.rectanglesValue.forEach((definition) => this.createRectangle({ definition }));
this.markersValue.forEach((definition) => {
this.createMarker({ definition });
});
this.polygonsValue.forEach((definition) => {
this.createPolygon({ definition });
});
this.polylinesValue.forEach((definition) => {
this.createPolyline({ definition });
});
this.circlesValue.forEach((definition) => {
this.createCircle({ definition });
});
this.rectanglesValue.forEach((definition) => {
this.createRectangle({ definition });
});
if (this.fitBoundsToMarkersValue) {
this.doFitBoundsToMarkers();
}
@@ -174,7 +184,7 @@ var map_controller_default = class extends abstract_map_controller_default {
const loader = new Loader(loaderOptions);
libraries = ["core", ...libraries.filter((library) => library !== "core")];
const librariesImplementations = await Promise.all(libraries.map((library) => loader.importLibrary(library)));
librariesImplementations.map((libraryImplementation, index) => {
librariesImplementations.forEach((libraryImplementation, index) => {
if (typeof libraryImplementation !== "object" || libraryImplementation === null) {
return;
}
@@ -188,7 +198,9 @@ var map_controller_default = class extends abstract_map_controller_default {
_loading = false;
_loaded = true;
onLoaded();
_onLoadedCallbacks.forEach((callback) => callback());
_onLoadedCallbacks.forEach((callback) => {
callback();
});
_onLoadedCallbacks = [];
}
centerValueChanged() {

View File

@@ -94,7 +94,7 @@ export default class extends AbstractMapController<
// see https://github.com/googlemaps/js-api-loader/issues/837 for more information.
libraries = ['core', ...libraries.filter((library) => library !== 'core')]; // Ensure 'core' is loaded first
const librariesImplementations = await Promise.all(libraries.map((library) => loader.importLibrary(library)));
librariesImplementations.map((libraryImplementation, index) => {
librariesImplementations.forEach((libraryImplementation, index) => {
if (typeof libraryImplementation !== 'object' || libraryImplementation === null) {
return;
}
@@ -103,7 +103,7 @@ export default class extends AbstractMapController<
// The following libraries are in a sub-namespace
if (['marker', 'places', 'geometry', 'journeySharing', 'drawing', 'visualization'].includes(library)) {
// @ts-ignore
// @ts-expect-error
_google.maps[library] = libraryImplementation as any;
} else {
_google.maps = { ..._google.maps, ...libraryImplementation };
@@ -113,7 +113,9 @@ export default class extends AbstractMapController<
_loading = false;
_loaded = true;
onLoaded();
_onLoadedCallbacks.forEach((callback) => callback());
_onLoadedCallbacks.forEach((callback) => {
callback();
});
_onLoadedCallbacks = [];
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../../../../tsconfig.package.json"
}

View File

@@ -33,11 +33,21 @@ var abstract_map_controller_default = class extends Controller {
this.createCircle = this.createDrawingFactory("circle", this.circles, this.doCreateCircle.bind(this));
this.createRectangle = this.createDrawingFactory("rectangle", this.rectangles, this.doCreateRectangle.bind(this));
this.map = this.doCreateMap({ definition: mapDefinition });
this.markersValue.forEach((definition) => this.createMarker({ definition }));
this.polygonsValue.forEach((definition) => this.createPolygon({ definition }));
this.polylinesValue.forEach((definition) => this.createPolyline({ definition }));
this.circlesValue.forEach((definition) => this.createCircle({ definition }));
this.rectanglesValue.forEach((definition) => this.createRectangle({ definition }));
this.markersValue.forEach((definition) => {
this.createMarker({ definition });
});
this.polygonsValue.forEach((definition) => {
this.createPolygon({ definition });
});
this.polylinesValue.forEach((definition) => {
this.createPolyline({ definition });
});
this.circlesValue.forEach((definition) => {
this.createCircle({ definition });
});
this.rectanglesValue.forEach((definition) => {
this.createRectangle({ definition });
});
if (this.fitBoundsToMarkersValue) {
this.doFitBoundsToMarkers();
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../../../../tsconfig.package.json"
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -9,7 +9,7 @@
import { describe, expect, it } from 'vitest';
import { registerReactControllerComponents } from '../../src/register_controller';
// @ts-ignore
// @ts-expect-error
import MyJsxComponent from '../fixtures/MyJsxComponent';
import MyTsxComponent from '../fixtures/MyTsxComponent';

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -31,7 +31,9 @@ class StimulusLazyControllerHandler {
this.lazyLoadNewControllers(document.documentElement);
}
lazyLoadExistingControllers(element) {
Array.from(element.querySelectorAll(`[${controllerAttribute}]`)).flatMap(extractControllerNamesFrom).forEach((controllerName) => this.loadLazyController(controllerName));
Array.from(element.querySelectorAll(`[${controllerAttribute}]`)).flatMap(extractControllerNamesFrom).forEach((controllerName) => {
this.loadLazyController(controllerName);
});
}
loadLazyController(name) {
if (!this.lazyControllers[name]) {
@@ -59,9 +61,9 @@ class StimulusLazyControllerHandler {
switch (type) {
case "attributes": {
if (attributeName === controllerAttribute && target.getAttribute(controllerAttribute)) {
extractControllerNamesFrom(target).forEach(
(controllerName) => this.loadLazyController(controllerName)
);
extractControllerNamesFrom(target).forEach((controllerName) => {
this.loadLazyController(controllerName);
});
}
break;
}

View File

@@ -66,10 +66,12 @@ class StimulusLazyControllerHandler {
private lazyLoadExistingControllers(element: Element) {
Array.from(element.querySelectorAll(`[${controllerAttribute}]`))
.flatMap(extractControllerNamesFrom)
.forEach((controllerName) => this.loadLazyController(controllerName));
.forEach((controllerName) => {
this.loadLazyController(controllerName);
});
}
private loadLazyController(name: string) {
private loadLazyController(name: string): void {
if (!this.lazyControllers[name]) {
return;
}
@@ -106,9 +108,9 @@ class StimulusLazyControllerHandler {
attributeName === controllerAttribute &&
(target as Element).getAttribute(controllerAttribute)
) {
extractControllerNamesFrom(target as Element).forEach((controllerName) =>
this.loadLazyController(controllerName)
);
extractControllerNamesFrom(target as Element).forEach((controllerName) => {
this.loadLazyController(controllerName);
});
}
break;
@@ -144,6 +146,6 @@ function extractControllerNamesFrom(element: Element): string[] {
}
function canRegisterController(name: string, application: Application) {
// @ts-ignore
// @ts-expect-error
return !application.router.modulesByIdentifier.has(name);
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -0,0 +1,3 @@
{
"extends": "../../../tsconfig.package.json"
}

View File

@@ -1,5 +1,5 @@
{
"//": "This file is used to compile UX packages for use in the browser.",
"//": "This file is used to compile UX package for use in the browser.",
"compilerOptions": {
"lib": ["dom", "es2015"],
"module": "es2015",