diff --git a/.storybook/main.ts b/.storybook/main.ts index b8dd82a7d..91403dfc0 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -30,6 +30,18 @@ const config: StorybookConfig = { docs: { autodocs: false, }, + webpackFinal: async (config) => { + const customConfig = { ...config }; + + if (!customConfig.resolve) { + customConfig.resolve = {}; + } + + customConfig.resolve.extensionAlias = { + '.js': ['.tsx', '.ts', '.js'], + }; + return customConfig; + }, }; export default config; diff --git a/.swcrc b/.swcrc index f9dfcd0d7..c30ce55f3 100644 --- a/.swcrc +++ b/.swcrc @@ -12,7 +12,8 @@ } }, "module": { - "type": "es6" + "type": "es6", + "strict": false }, "minify": false } diff --git a/baseESMJestConfig.js b/baseESMJestConfig.js new file mode 100644 index 000000000..ff3c0f6f8 --- /dev/null +++ b/baseESMJestConfig.js @@ -0,0 +1,29 @@ +/* eslint-disable */ + +function getConfig(packageName) { + return { + testEnvironment: 'jsdom', + modulePathIgnorePatterns: ['/dist/'], + testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'], + extensionsToTreatAsEsm: ['.ts', '.tsx'], + moduleNameMapper: { + '^(\\.\\.?\\/.+)\\.js$': '$1', + }, + transform: { + '^.+\\.tsx?$': ['@swc/jest'], + }, + reporters: [ + 'default', + [ + 'jest-junit', + { + outputDirectory: '../../reports', + outputName: `${packageName}-results.xml`, + addFileAttribute: true, + }, + ], + ], + }; +} + +module.exports = getConfig; diff --git a/baseJestConfig.js b/baseJestConfig.js index 1fbf26495..9be26d608 100644 --- a/baseJestConfig.js +++ b/baseJestConfig.js @@ -5,6 +5,10 @@ function getConfig(packageName) { testEnvironment: 'jsdom', modulePathIgnorePatterns: ['/dist/'], testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'], + // for esm imports with .js extensions + moduleNameMapper: { + '^(\\.\\.?\\/.+)\\.js$': '$1', + }, reporters: [ 'default', [ diff --git a/packages/_shared/.eslintrc.js b/packages/_shared/.eslintrc.cjs similarity index 100% rename from packages/_shared/.eslintrc.js rename to packages/_shared/.eslintrc.cjs diff --git a/packages/_shared/jest.config.js b/packages/_shared/jest.config.js index 2da53fcff..3f7a642e4 100644 --- a/packages/_shared/jest.config.js +++ b/packages/_shared/jest.config.js @@ -1,10 +1,9 @@ /* eslint-disable */ +import baseConfig from '../../baseESMJestConfig.js'; -const baseConfig = require('../../baseJestConfig'); +import packageJson from './package.json' assert { type: 'json' }; +const packageName = packageJson.name.split('@contentful/')[1]; -const package = require('./package.json'); -const packageName = package.name.split('@contentful/')[1]; - -module.exports = { +export default { ...baseConfig(packageName), }; diff --git a/packages/_shared/package.json b/packages/_shared/package.json index 309c4e93c..9b698195b 100644 --- a/packages/_shared/package.json +++ b/packages/_shared/package.json @@ -1,17 +1,9 @@ { "name": "@contentful/field-editor-shared", "version": "1.4.2", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "type": "module", + "main": "dist/esm/index.js", "types": "dist/types/index.d.ts", - "exports": { - ".": { - "types": "./dist/types/index.d.ts", - "require": "./dist/cjs/index.js", - "default": "./dist/cjs/index.js" - }, - "./package.json": "./package.json" - }, "files": [ "dist" ], @@ -23,26 +15,26 @@ }, "scripts": { "watch": "yarn concurrently \"yarn:watch:*\"", - "watch:cjs": "yarn build:cjs -w", "watch:esm": "yarn build:esm -w", "watch:types": "yarn build:types --watch", - "build": "yarn build:types && yarn build:cjs && yarn build:esm", + "build": "yarn build:types && yarn build:esm", "build:types": "tsc --outDir dist/types --emitDeclarationOnly", - "build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs", "build:esm": "swc src --config-file ../../.swcrc -d dist/esm", "test": "jest --watch", - "test:ci": "jest --ci", + "test:ci": "yarn node --experimental-vm-modules $(yarn bin jest --ci)", "tsc": "tsc -p ./ --noEmit" }, "devDependencies": { "@contentful/app-sdk": "^4.17.1", - "@contentful/field-editor-test-utils": "^1.4.3" + "@contentful/field-editor-test-utils": "^1.4.3", + "@types/lodash-es": "4.17.9", + "@jest/globals": "29.7.0" }, "dependencies": { "@contentful/f36-note": "^4.2.8", "@contentful/f36-tokens": "^4.0.0", "emotion": "^10.0.17", - "lodash": "^4.17.15" + "lodash-es": "4.17.21" }, "peerDependencies": { "@contentful/app-sdk": "^4.17.1", diff --git a/packages/_shared/src/CharValidation.tsx b/packages/_shared/src/CharValidation.tsx index 198991d31..8077ae7ea 100644 --- a/packages/_shared/src/CharValidation.tsx +++ b/packages/_shared/src/CharValidation.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; -import { ValidationType } from './types'; +import { ValidationType } from './types.js'; interface CharValidationProps { constraints: ValidationType; diff --git a/packages/_shared/src/FieldConnector.test.tsx b/packages/_shared/src/FieldConnector.test.tsx index 75f246f74..41c8fdf26 100644 --- a/packages/_shared/src/FieldConnector.test.tsx +++ b/packages/_shared/src/FieldConnector.test.tsx @@ -1,16 +1,18 @@ import * as React from 'react'; import { createFakeFieldAPI } from '@contentful/field-editor-test-utils'; +import { jest } from '@jest/globals'; import { render } from '@testing-library/react'; -import noop from 'lodash/noop'; +import { noop } from 'lodash-es'; -import { FieldConnector, FieldConnectorChildProps } from './FieldConnector'; +import { FieldConnector, FieldConnectorChildProps } from './FieldConnector.js'; it('does not rerender with outdated value after calling setValue', () => { + noop(); + expect(true).toBe(true); function getChild(): FieldConnectorChildProps { - return props.children.mock.calls[props.children.mock.calls.length - 1][0]; + return props.children.mock.calls[props.children.mock.calls.length - 1][0] as any; } - const onSchemaErrorsChanged = jest.fn(); const [field] = createFakeFieldAPI((field: any) => { return { @@ -20,27 +22,20 @@ it('does not rerender with outdated value after calling setValue', () => { onSchemaErrorsChanged, }; }, 'initial value'); - const props = { isInitiallyDisabled: false, children: jest.fn().mockImplementation(() => null), field, debounce: 0, }; - render(); - let child = getChild(); expect(child.value).toBe('initial value'); const initialRenderCount = props.children.mock.calls.length; - child.setValue('new value'); - - onSchemaErrorsChanged.mock.calls.forEach(([cb]) => cb([])); - + onSchemaErrorsChanged.mock.calls.forEach(([cb]) => (cb as any)([])); child = getChild(); expect(child.value).toBe('new value'); - // to ensure that there was actually a rerender after calling `setValue` as we want to test that we don't rerender with outdated data expect(props.children.mock.calls.length).toBeGreaterThan(initialRenderCount); }); diff --git a/packages/_shared/src/FieldConnector.ts b/packages/_shared/src/FieldConnector.ts index 9809d7618..bbdd86aff 100644 --- a/packages/_shared/src/FieldConnector.ts +++ b/packages/_shared/src/FieldConnector.ts @@ -1,8 +1,8 @@ import * as React from 'react'; import { FieldAPI, ValidationError } from '@contentful/app-sdk'; -import debounce from 'lodash/debounce'; -import isEqual from 'lodash/isEqual'; +import { debounce } from 'lodash-es'; +import { isEqual } from 'lodash-es'; type Nullable = null | undefined; diff --git a/packages/_shared/src/ModalDialogLauncher.tsx b/packages/_shared/src/ModalDialogLauncher.tsx index a4cc7d1e2..b2fcd6230 100644 --- a/packages/_shared/src/ModalDialogLauncher.tsx +++ b/packages/_shared/src/ModalDialogLauncher.tsx @@ -4,8 +4,8 @@ import * as React from 'react'; import ReactDOM from 'react-dom'; import { OpenCustomWidgetOptions } from '@contentful/app-sdk'; -import { Modal, ModalHeader } from '@contentful/f36-components'; -import isNumber from 'lodash/isNumber'; +import { Modal, ModalHeader } from '@contentful/f36-modal'; +import isNumber from 'lodash-es/isNumber.js'; export function open(componentRenderer: (params: { onClose: Function; isShown: boolean }) => any) { let rootDom: any = null; diff --git a/packages/_shared/src/index.tsx b/packages/_shared/src/index.tsx index bc7e3076a..2b0bfa7c2 100644 --- a/packages/_shared/src/index.tsx +++ b/packages/_shared/src/index.tsx @@ -1,4 +1,4 @@ -export { +export type { AccessAPI, AppConfigAPI, BaseAppSDK, @@ -18,18 +18,19 @@ export { SpaceAPI, WindowAPI, } from '@contentful/app-sdk'; -export { CharCounter } from './CharCounter'; -export { CharValidation } from './CharValidation'; -export { FieldConnector } from './FieldConnector'; -export type { FieldConnectorChildProps } from './FieldConnector'; -export { PredefinedValuesError } from './PredefinedValuesError'; -export { Asset, Entry, File } from './typesEntity'; -export { isValidImage } from './utils/isValidImage'; -export { shortenStorageUnit, toLocaleString } from './utils/shortenStorageUnit'; + +export { CharCounter } from './CharCounter.js'; +export { CharValidation } from './CharValidation.js'; +export { FieldConnector } from './FieldConnector.js'; +export type { FieldConnectorChildProps } from './FieldConnector.js'; +export { PredefinedValuesError } from './PredefinedValuesError.js'; +export type { Asset, Entry, File } from './typesEntity.js'; +export { isValidImage } from './utils/isValidImage.js'; +export { shortenStorageUnit, toLocaleString } from './utils/shortenStorageUnit.js'; export { ModalDialogLauncher }; export { entityHelpers }; export { ConstraintsUtils }; -import * as ModalDialogLauncher from './ModalDialogLauncher'; -import * as ConstraintsUtils from './utils/constraints'; -import * as entityHelpers from './utils/entityHelpers'; +import * as ModalDialogLauncher from './ModalDialogLauncher.js'; +import * as ConstraintsUtils from './utils/constraints.js'; +import * as entityHelpers from './utils/entityHelpers.js'; diff --git a/packages/_shared/src/typesEntity.ts b/packages/_shared/src/typesEntity.ts index daad61bcb..ca9bc3d96 100644 --- a/packages/_shared/src/typesEntity.ts +++ b/packages/_shared/src/typesEntity.ts @@ -1,4 +1,11 @@ -export { BaseAppSDK, ContentType, ContentTypeField, Link, Entry, Asset } from '@contentful/app-sdk'; +export type { + BaseAppSDK, + ContentType, + ContentTypeField, + Link, + Entry, + Asset, +} from '@contentful/app-sdk'; export interface File { fileName: string; diff --git a/packages/_shared/src/utils/constraints.ts b/packages/_shared/src/utils/constraints.ts index 4d46a5288..ac4624f1a 100644 --- a/packages/_shared/src/utils/constraints.ts +++ b/packages/_shared/src/utils/constraints.ts @@ -5,9 +5,9 @@ * values against that constraint. */ -import isNumber from 'lodash/isNumber'; +import isNumber from 'lodash-es/isNumber.js'; -import { ValidationType } from '../types'; +import { ValidationType } from '../types.js'; export function fromFieldValidations( validations: Record[] = [], diff --git a/packages/_shared/src/utils/entityHelpers.ts b/packages/_shared/src/utils/entityHelpers.ts index 72c0cc03c..8e62e40a2 100644 --- a/packages/_shared/src/utils/entityHelpers.ts +++ b/packages/_shared/src/utils/entityHelpers.ts @@ -1,8 +1,8 @@ -import get from 'lodash/get'; -import isObject from 'lodash/isObject'; -import isString from 'lodash/isString'; +import get from 'lodash-es/get.js'; +import isObject from 'lodash-es/isObject.js'; +import isString from 'lodash-es/isString.js'; -import { Asset, ContentType, ContentTypeField, Entry, File } from '../typesEntity'; +import { Asset, ContentType, ContentTypeField, Entry, File } from '../typesEntity.js'; function titleOrDefault(title: string | undefined, defaultTitle: string): string { if (!isString(title)) { diff --git a/packages/_shared/src/utils/isValidImage.ts b/packages/_shared/src/utils/isValidImage.ts index 40cda9bfa..412549d93 100644 --- a/packages/_shared/src/utils/isValidImage.ts +++ b/packages/_shared/src/utils/isValidImage.ts @@ -1,4 +1,4 @@ -import { File } from '../typesEntity'; +import { File } from '../typesEntity.js'; /** * Checks whether the passed content type matches one of our valid MIME types diff --git a/packages/_shared/tsconfig.json b/packages/_shared/tsconfig.json index dd2fdf530..c5eb62a8e 100644 --- a/packages/_shared/tsconfig.json +++ b/packages/_shared/tsconfig.json @@ -2,9 +2,8 @@ "extends": "../../tsconfig.json", "include": ["src", "types"], "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", - "moduleResolution": "bundler", + "module": "Node16", + "moduleResolution": "Node16", "lib": ["dom", "esnext"], "rootDir": "./src", "baseUrl": "./", diff --git a/packages/_test/.eslintrc.js b/packages/_test/.eslintrc.cjs similarity index 100% rename from packages/_test/.eslintrc.js rename to packages/_test/.eslintrc.cjs diff --git a/packages/_test/jest.config.js b/packages/_test/jest.config.js index 2da53fcff..3f7a642e4 100644 --- a/packages/_test/jest.config.js +++ b/packages/_test/jest.config.js @@ -1,10 +1,9 @@ /* eslint-disable */ +import baseConfig from '../../baseESMJestConfig.js'; -const baseConfig = require('../../baseJestConfig'); +import packageJson from './package.json' assert { type: 'json' }; +const packageName = packageJson.name.split('@contentful/')[1]; -const package = require('./package.json'); -const packageName = package.name.split('@contentful/')[1]; - -module.exports = { +export default { ...baseConfig(packageName), }; diff --git a/packages/_test/package.json b/packages/_test/package.json index 1e3ff273b..5b4e0b804 100644 --- a/packages/_test/package.json +++ b/packages/_test/package.json @@ -1,17 +1,9 @@ { "name": "@contentful/field-editor-test-utils", "version": "1.4.3", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "type": "module", + "main": "dist/esm/index.js", "types": "dist/types/index.d.ts", - "exports": { - ".": { - "types": "./dist/types/index.d.ts", - "require": "./dist/cjs/index.js", - "default": "./dist/cjs/index.js" - }, - "./package.json": "./package.json" - }, "files": [ "dist" ], @@ -23,12 +15,10 @@ }, "scripts": { "watch": "yarn concurrently \"yarn:watch:*\"", - "watch:cjs": "yarn build:cjs -w", "watch:esm": "yarn build:esm -w", "watch:types": "yarn build:types --watch", - "build": "yarn build:types && yarn build:cjs && yarn build:esm", + "build": "yarn build:types && yarn build:esm", "build:types": "tsc --outDir dist/types --emitDeclarationOnly", - "build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs", "build:esm": "swc src --config-file ../../.swcrc -d dist/esm", "test": "jest --watch", "test:ci": "jest --ci", diff --git a/packages/_test/src/createFakeFieldAPI.test.ts b/packages/_test/src/createFakeFieldAPI.test.ts index 71c18bd34..fb638241b 100644 --- a/packages/_test/src/createFakeFieldAPI.test.ts +++ b/packages/_test/src/createFakeFieldAPI.test.ts @@ -1,4 +1,4 @@ -import { createFakeFieldAPI } from './createFakeFieldAPI'; +import { createFakeFieldAPI } from './createFakeFieldAPI.js'; describe('createFakeFieldAPI', () => { it('exposes all methods', () => { diff --git a/packages/_test/src/createFakeFieldAPI.ts b/packages/_test/src/createFakeFieldAPI.ts index 4e910947f..d4cd63bce 100644 --- a/packages/_test/src/createFakeFieldAPI.ts +++ b/packages/_test/src/createFakeFieldAPI.ts @@ -12,6 +12,7 @@ export function createFakeFieldAPI( customizeMock: CustomizeMockFn = identity, initialValue?: T ): [FieldAPI, Emitter] { + // @ts-expect-error -- TODO: describe this error const emitter: Emitter = mitt(); // eslint-disable-next-line -- TODO: describe this disable diff --git a/packages/_test/src/createFakeSpaceAPI.ts b/packages/_test/src/createFakeSpaceAPI.ts index feed6955f..c35f8c32d 100644 --- a/packages/_test/src/createFakeSpaceAPI.ts +++ b/packages/_test/src/createFakeSpaceAPI.ts @@ -1,6 +1,6 @@ import { ContentType, SearchQuery, SpaceAPI, Entry } from '@contentful/app-sdk'; -import { createEntry } from './fakesFactory'; +import { createEntry } from './fakesFactory.js'; function identity(item: T): T { return item; diff --git a/packages/_test/src/index.ts b/packages/_test/src/index.ts index 79ef81341..1ff2c0171 100644 --- a/packages/_test/src/index.ts +++ b/packages/_test/src/index.ts @@ -1,6 +1,6 @@ -export { createFakeCMAAdapter } from './createFakeCMAAdapter'; -export { createFakeFieldAPI } from './createFakeFieldAPI'; -export { createFakeLocalesAPI } from './createFakeLocalesAPI'; -export { createFakeSpaceAPI } from './createFakeSpaceAPI'; -export { createFakeNavigatorAPI } from './createFakeNavigatorAPI'; -export { ActionsPlayground } from './ActionsPlayground'; +export { createFakeCMAAdapter } from './createFakeCMAAdapter.js'; +export { createFakeFieldAPI } from './createFakeFieldAPI.js'; +export { createFakeLocalesAPI } from './createFakeLocalesAPI.js'; +export { createFakeSpaceAPI } from './createFakeSpaceAPI.js'; +export { createFakeNavigatorAPI } from './createFakeNavigatorAPI.js'; +export { ActionsPlayground } from './ActionsPlayground.js'; diff --git a/packages/_test/tsconfig.json b/packages/_test/tsconfig.json index dd2fdf530..c5eb62a8e 100644 --- a/packages/_test/tsconfig.json +++ b/packages/_test/tsconfig.json @@ -2,9 +2,8 @@ "extends": "../../tsconfig.json", "include": ["src", "types"], "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", - "moduleResolution": "bundler", + "module": "Node16", + "moduleResolution": "Node16", "lib": ["dom", "esnext"], "rootDir": "./src", "baseUrl": "./", diff --git a/packages/boolean/.eslintrc.js b/packages/boolean/.eslintrc.cjs similarity index 100% rename from packages/boolean/.eslintrc.js rename to packages/boolean/.eslintrc.cjs diff --git a/packages/boolean/jest.config.js b/packages/boolean/jest.config.js index 2da53fcff..c0b29bf39 100644 --- a/packages/boolean/jest.config.js +++ b/packages/boolean/jest.config.js @@ -1,10 +1,8 @@ -/* eslint-disable */ +import baseConfig from '../../baseESMJestConfig.js'; +import packageJSON from './package.json' assert { type: 'json' }; -const baseConfig = require('../../baseJestConfig'); +const packageName = packageJSON.name.split('@contentful/')[1]; -const package = require('./package.json'); -const packageName = package.name.split('@contentful/')[1]; - -module.exports = { +export default { ...baseConfig(packageName), }; diff --git a/packages/boolean/package.json b/packages/boolean/package.json index 45e4b3e72..02e87191f 100644 --- a/packages/boolean/package.json +++ b/packages/boolean/package.json @@ -1,17 +1,9 @@ { "name": "@contentful/field-editor-boolean", "version": "1.4.2", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "type": "module", + "main": "dist/esm/index.js", "types": "dist/types/index.d.ts", - "exports": { - ".": { - "types": "./dist/types/index.d.ts", - "require": "./dist/cjs/index.js", - "default": "./dist/cjs/index.js" - }, - "./package.json": "./package.json" - }, "files": [ "dist" ], @@ -23,15 +15,13 @@ }, "scripts": { "watch": "yarn concurrently \"yarn:watch:*\"", - "watch:cjs": "yarn build:cjs -w", "watch:esm": "yarn build:esm -w", "watch:types": "yarn build:types --watch", - "build": "yarn build:types && yarn build:cjs && yarn build:esm", + "build": "yarn build:types && yarn build:esm", "build:types": "tsc --outDir dist/types --emitDeclarationOnly", - "build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs", "build:esm": "swc src --config-file ../../.swcrc -d dist/esm", "test": "jest --watch", - "test:ci": "jest --ci", + "test:ci": "yarn node --experimental-vm-modules $(yarn bin jest --ci)", "tsc": "tsc -p ./ --noEmit" }, "dependencies": { @@ -43,7 +33,8 @@ "nanoid": "^3.1.3" }, "devDependencies": { - "@contentful/field-editor-test-utils": "^1.4.3" + "@contentful/field-editor-test-utils": "^1.4.3", + "@jest/globals": "29.7.0" }, "peerDependencies": { "react": ">=16.8.0" diff --git a/packages/boolean/src/Boolean.spec.tsx b/packages/boolean/src/Boolean.spec.tsx index e934538f8..4192b015d 100644 --- a/packages/boolean/src/Boolean.spec.tsx +++ b/packages/boolean/src/Boolean.spec.tsx @@ -1,10 +1,11 @@ import * as React from 'react'; import { createFakeFieldAPI } from '@contentful/field-editor-test-utils'; +import { jest } from '@jest/globals'; import '@testing-library/jest-dom/extend-expect'; import { cleanup, configure, fireEvent, render } from '@testing-library/react'; -import { BooleanEditor } from './BooleanEditor'; +import { BooleanEditor } from './BooleanEditor.js'; configure({ testIdAttribute: 'data-test-id', diff --git a/packages/boolean/src/BooleanEditor.tsx b/packages/boolean/src/BooleanEditor.tsx index 750ee51ff..075fab4a7 100644 --- a/packages/boolean/src/BooleanEditor.tsx +++ b/packages/boolean/src/BooleanEditor.tsx @@ -1,8 +1,10 @@ import * as React from 'react'; -import { TextLink, Flex, Radio } from '@contentful/f36-components'; +import { Flex } from '@contentful/f36-core'; +import { Radio } from '@contentful/f36-forms'; +import { TextLink } from '@contentful/f36-text-link'; import { FieldAPI, ParametersAPI, FieldConnector } from '@contentful/field-editor-shared'; -import get from 'lodash/get'; +import get from 'lodash-es/get.js'; import { nanoid } from 'nanoid'; export interface BooleanEditorProps { diff --git a/packages/boolean/src/index.tsx b/packages/boolean/src/index.tsx index cce5f1446..b9b60fe63 100644 --- a/packages/boolean/src/index.tsx +++ b/packages/boolean/src/index.tsx @@ -1 +1 @@ -export { BooleanEditor } from './BooleanEditor'; +export { BooleanEditor } from './BooleanEditor.js'; diff --git a/packages/boolean/tsconfig.json b/packages/boolean/tsconfig.json index dd2fdf530..c5eb62a8e 100644 --- a/packages/boolean/tsconfig.json +++ b/packages/boolean/tsconfig.json @@ -2,9 +2,8 @@ "extends": "../../tsconfig.json", "include": ["src", "types"], "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", - "moduleResolution": "bundler", + "module": "Node16", + "moduleResolution": "Node16", "lib": ["dom", "esnext"], "rootDir": "./src", "baseUrl": "./", diff --git a/packages/checkbox/.eslintrc.js b/packages/checkbox/.eslintrc.cjs similarity index 100% rename from packages/checkbox/.eslintrc.js rename to packages/checkbox/.eslintrc.cjs diff --git a/packages/checkbox/jest.config.js b/packages/checkbox/jest.config.js index 2da53fcff..c0b29bf39 100644 --- a/packages/checkbox/jest.config.js +++ b/packages/checkbox/jest.config.js @@ -1,10 +1,8 @@ -/* eslint-disable */ +import baseConfig from '../../baseESMJestConfig.js'; +import packageJSON from './package.json' assert { type: 'json' }; -const baseConfig = require('../../baseJestConfig'); +const packageName = packageJSON.name.split('@contentful/')[1]; -const package = require('./package.json'); -const packageName = package.name.split('@contentful/')[1]; - -module.exports = { +export default { ...baseConfig(packageName), }; diff --git a/packages/checkbox/package.json b/packages/checkbox/package.json index 7833adde5..ddf282dea 100644 --- a/packages/checkbox/package.json +++ b/packages/checkbox/package.json @@ -1,17 +1,9 @@ { "name": "@contentful/field-editor-checkbox", "version": "1.4.2", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "type": "module", + "main": "dist/esm/index.js", "types": "dist/types/index.d.ts", - "exports": { - ".": { - "types": "./dist/types/index.d.ts", - "require": "./dist/cjs/index.js", - "default": "./dist/cjs/index.js" - }, - "./package.json": "./package.json" - }, "files": [ "dist" ], @@ -23,12 +15,10 @@ }, "scripts": { "watch": "yarn concurrently \"yarn:watch:*\"", - "watch:cjs": "yarn build:cjs -w", "watch:esm": "yarn build:esm -w", "watch:types": "yarn build:types --watch", - "build": "yarn build:types && yarn build:cjs && yarn build:esm", + "build": "yarn build:types && yarn build:esm", "build:types": "tsc --outDir dist/types --emitDeclarationOnly", - "build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs", "build:esm": "swc src --config-file ../../.swcrc -d dist/esm", "test": "jest --watch", "test:ci": "jest --ci", @@ -42,7 +32,8 @@ "lodash": "^4.17.15" }, "devDependencies": { - "@contentful/field-editor-test-utils": "^1.4.3" + "@contentful/field-editor-test-utils": "^1.4.3", + "@jest/globals": "29.7.0" }, "peerDependencies": { "react": ">=16.8.0" diff --git a/packages/checkbox/src/CheckboxEditor.spec.tsx b/packages/checkbox/src/CheckboxEditor.spec.tsx index 7d5d8fbe6..d703ab19e 100644 --- a/packages/checkbox/src/CheckboxEditor.spec.tsx +++ b/packages/checkbox/src/CheckboxEditor.spec.tsx @@ -1,10 +1,11 @@ import * as React from 'react'; import { createFakeFieldAPI, createFakeLocalesAPI } from '@contentful/field-editor-test-utils'; +import { jest } from '@jest/globals'; import '@testing-library/jest-dom/extend-expect'; import { cleanup, configure, fireEvent, render } from '@testing-library/react'; -import { CheckboxEditor } from './CheckboxEditor'; +import { CheckboxEditor } from './CheckboxEditor.js'; configure({ testIdAttribute: 'data-test-id', diff --git a/packages/checkbox/src/CheckboxEditor.tsx b/packages/checkbox/src/CheckboxEditor.tsx index 9e0739710..5f2eb9acc 100644 --- a/packages/checkbox/src/CheckboxEditor.tsx +++ b/packages/checkbox/src/CheckboxEditor.tsx @@ -1,8 +1,9 @@ import * as React from 'react'; import { useState } from 'react'; -import { Checkbox, Box } from '@contentful/f36-components'; -import { TextLink, Form } from '@contentful/f36-components'; +import { Box } from '@contentful/f36-core'; +import { Checkbox, Form } from '@contentful/f36-forms'; +import { TextLink } from '@contentful/f36-text-link'; import { FieldAPI, FieldConnector, @@ -10,10 +11,10 @@ import { PredefinedValuesError, } from '@contentful/field-editor-shared'; import { cx } from 'emotion'; -import get from 'lodash/get'; +import get from 'lodash-es/get.js'; import { nanoid } from 'nanoid'; -import * as styles from './styles'; +import * as styles from './styles.js'; export interface CheckboxEditorProps { /** diff --git a/packages/checkbox/src/index.tsx b/packages/checkbox/src/index.tsx index 0faa311c4..5cd601e70 100644 --- a/packages/checkbox/src/index.tsx +++ b/packages/checkbox/src/index.tsx @@ -1 +1 @@ -export { CheckboxEditor } from './CheckboxEditor'; +export { CheckboxEditor } from './CheckboxEditor.js'; diff --git a/packages/checkbox/tsconfig.json b/packages/checkbox/tsconfig.json index dd2fdf530..c5eb62a8e 100644 --- a/packages/checkbox/tsconfig.json +++ b/packages/checkbox/tsconfig.json @@ -2,9 +2,8 @@ "extends": "../../tsconfig.json", "include": ["src", "types"], "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", - "moduleResolution": "bundler", + "module": "Node16", + "moduleResolution": "Node16", "lib": ["dom", "esnext"], "rootDir": "./src", "baseUrl": "./", diff --git a/packages/date/.eslintrc.js b/packages/date/.eslintrc.cjs similarity index 100% rename from packages/date/.eslintrc.js rename to packages/date/.eslintrc.cjs diff --git a/packages/date/jest.config.js b/packages/date/jest.config.js index 2da53fcff..c0b29bf39 100644 --- a/packages/date/jest.config.js +++ b/packages/date/jest.config.js @@ -1,10 +1,8 @@ -/* eslint-disable */ +import baseConfig from '../../baseESMJestConfig.js'; +import packageJSON from './package.json' assert { type: 'json' }; -const baseConfig = require('../../baseJestConfig'); +const packageName = packageJSON.name.split('@contentful/')[1]; -const package = require('./package.json'); -const packageName = package.name.split('@contentful/')[1]; - -module.exports = { +export default { ...baseConfig(packageName), }; diff --git a/packages/date/package.json b/packages/date/package.json index 73d7986bd..83e29be4e 100644 --- a/packages/date/package.json +++ b/packages/date/package.json @@ -1,17 +1,9 @@ { "name": "@contentful/field-editor-date", "version": "1.6.2", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "type": "module", + "main": "dist/esm/index.js", "types": "dist/types/index.d.ts", - "exports": { - ".": { - "types": "./dist/types/index.d.ts", - "require": "./dist/cjs/index.js", - "default": "./dist/cjs/index.js" - }, - "./package.json": "./package.json" - }, "style": "styles/styles.css", "files": [ "dist" @@ -24,12 +16,10 @@ }, "scripts": { "watch": "yarn concurrently \"yarn:watch:*\"", - "watch:cjs": "yarn build:cjs -w", "watch:esm": "yarn build:esm -w", "watch:types": "yarn build:types --watch", - "build": "yarn build:types && yarn build:cjs && yarn build:esm", + "build": "yarn build:types && yarn build:esm", "build:types": "tsc --outDir dist/types --emitDeclarationOnly", - "build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs", "build:esm": "swc src --config-file ../../.swcrc -d dist/esm", "test": "jest --watch", "test:ci": "jest --ci", @@ -45,6 +35,7 @@ "devDependencies": { "@babel/core": "^7.7.4", "@contentful/field-editor-test-utils": "^1.4.3", + "@jest/globals": "29.7.0", "@types/timezoned-date": "^3.0.0", "timezoned-date": "^3.0.2" }, diff --git a/packages/date/src/DateEditor.tsx b/packages/date/src/DateEditor.tsx index 51d6b58eb..a04987373 100644 --- a/packages/date/src/DateEditor.tsx +++ b/packages/date/src/DateEditor.tsx @@ -5,16 +5,16 @@ import tokens from '@contentful/f36-tokens'; import { FieldAPI, FieldConnector, ParametersAPI } from '@contentful/field-editor-shared'; import { css } from 'emotion'; -import { DatepickerInput } from './DatepickerInput'; -import { TimepickerInput } from './TimepickerInput'; -import { TimezonepickerInput } from './TimezonePickerInput'; -import { TimeFormat, DateTimeFormat, TimeResult } from './types'; +import { DatepickerInput } from './DatepickerInput.js'; +import { TimepickerInput } from './TimepickerInput.js'; +import { TimezonepickerInput } from './TimezonePickerInput.js'; +import { TimeFormat, DateTimeFormat, TimeResult } from './types.js'; import { userInputFromDatetime, buildFieldValue, getDefaultAMPM, getDefaultUtcOffset, -} from './utils/date'; +} from './utils/date.js'; export interface DateEditorProps { /** diff --git a/packages/date/src/TimezonePickerInput.tsx b/packages/date/src/TimezonePickerInput.tsx index 35e218e76..3bc004076 100644 --- a/packages/date/src/TimezonePickerInput.tsx +++ b/packages/date/src/TimezonePickerInput.tsx @@ -2,8 +2,7 @@ import React, { ChangeEvent } from 'react'; import { Select } from '@contentful/f36-components'; -import { zoneOffsets, defaultZoneOffset } from './utils/zoneOffsets'; - +import { zoneOffsets, defaultZoneOffset } from './utils/zoneOffsets.js'; export type TimezonepickerProps = { disabled: boolean; @@ -23,7 +22,8 @@ export const TimezonepickerInput = ({ isDisabled={disabled} onChange={(e: ChangeEvent) => { onChange(e.currentTarget.value); - }}> + }} + > {zoneOffsets.map((offset) => ( UTC{offset} diff --git a/packages/date/src/index.tsx b/packages/date/src/index.tsx index 0ffa88383..d815e345d 100644 --- a/packages/date/src/index.tsx +++ b/packages/date/src/index.tsx @@ -1,2 +1,2 @@ -export { DateEditor } from './DateEditor'; -export { zoneOffsets } from './utils/zoneOffsets'; +export { DateEditor } from './DateEditor.js'; +export { zoneOffsets } from './utils/zoneOffsets.js'; diff --git a/packages/date/src/utils/data.spec.ts b/packages/date/src/utils/data.spec.ts index 60cd539e7..5f209dd3f 100644 --- a/packages/date/src/utils/data.spec.ts +++ b/packages/date/src/utils/data.spec.ts @@ -1,6 +1,6 @@ // eslint-disable-next-line -- TODO: move to date-fns import moment from 'moment'; -import { buildFieldValue } from './date'; +import { buildFieldValue } from './date.js'; describe('date utils', () => { describe('buildFieldValue', () => { diff --git a/packages/date/src/utils/date.ts b/packages/date/src/utils/date.ts index d3038fccc..1212ba008 100644 --- a/packages/date/src/utils/date.ts +++ b/packages/date/src/utils/date.ts @@ -1,6 +1,6 @@ // eslint-disable-next-line -- TODO: move to date-fns import moment from 'moment'; -import { TimeResult } from '../types'; +import { TimeResult } from '../types.js'; const ZONE_RX = /(Z|[+-]\d{2}[:+]?\d{2})$/; diff --git a/packages/date/tsconfig.json b/packages/date/tsconfig.json index dd2fdf530..c5eb62a8e 100644 --- a/packages/date/tsconfig.json +++ b/packages/date/tsconfig.json @@ -2,9 +2,8 @@ "extends": "../../tsconfig.json", "include": ["src", "types"], "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", - "moduleResolution": "bundler", + "module": "Node16", + "moduleResolution": "Node16", "lib": ["dom", "esnext"], "rootDir": "./src", "baseUrl": "./", diff --git a/packages/dropdown/.eslintrc.js b/packages/dropdown/.eslintrc.cjs similarity index 100% rename from packages/dropdown/.eslintrc.js rename to packages/dropdown/.eslintrc.cjs diff --git a/packages/dropdown/jest.config.js b/packages/dropdown/jest.config.js index 2da53fcff..c0b29bf39 100644 --- a/packages/dropdown/jest.config.js +++ b/packages/dropdown/jest.config.js @@ -1,10 +1,8 @@ -/* eslint-disable */ +import baseConfig from '../../baseESMJestConfig.js'; +import packageJSON from './package.json' assert { type: 'json' }; -const baseConfig = require('../../baseJestConfig'); +const packageName = packageJSON.name.split('@contentful/')[1]; -const package = require('./package.json'); -const packageName = package.name.split('@contentful/')[1]; - -module.exports = { +export default { ...baseConfig(packageName), }; diff --git a/packages/dropdown/package.json b/packages/dropdown/package.json index 6cb940d03..f58038d34 100644 --- a/packages/dropdown/package.json +++ b/packages/dropdown/package.json @@ -1,17 +1,9 @@ { "name": "@contentful/field-editor-dropdown", "version": "1.4.2", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "type": "module", + "main": "dist/esm/index.js", "types": "dist/types/index.d.ts", - "exports": { - ".": { - "types": "./dist/types/index.d.ts", - "require": "./dist/cjs/index.js", - "default": "./dist/cjs/index.js" - }, - "./package.json": "./package.json" - }, "files": [ "dist" ], @@ -23,12 +15,10 @@ }, "scripts": { "watch": "yarn concurrently \"yarn:watch:*\"", - "watch:cjs": "yarn build:cjs -w", "watch:esm": "yarn build:esm -w", "watch:types": "yarn build:types --watch", - "build": "yarn build:types && yarn build:cjs && yarn build:esm", + "build": "yarn build:types && yarn build:esm", "build:types": "tsc --outDir dist/types --emitDeclarationOnly", - "build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs", "build:esm": "swc src --config-file ../../.swcrc -d dist/esm", "test": "jest --watch", "test:ci": "jest --ci --passWithNoTests", @@ -44,6 +34,7 @@ }, "devDependencies": { "@contentful/field-editor-test-utils": "^1.4.3", + "@jest/globals": "29.7.0", "contentful-management": "^10.0.0" }, "peerDependencies": { diff --git a/packages/dropdown/src/DropdownEditor.spec.tsx b/packages/dropdown/src/DropdownEditor.spec.tsx index dad5745a3..9be81cbb8 100644 --- a/packages/dropdown/src/DropdownEditor.spec.tsx +++ b/packages/dropdown/src/DropdownEditor.spec.tsx @@ -1,10 +1,11 @@ import * as React from 'react'; import { createFakeFieldAPI, createFakeLocalesAPI } from '@contentful/field-editor-test-utils'; +import { jest } from '@jest/globals'; import '@testing-library/jest-dom/extend-expect'; import { cleanup, configure, fireEvent, render } from '@testing-library/react'; -import { DropdownEditor } from './DropdownEditor'; +import { DropdownEditor } from './DropdownEditor.js'; configure({ testIdAttribute: 'data-test-id', diff --git a/packages/dropdown/src/DropdownEditor.tsx b/packages/dropdown/src/DropdownEditor.tsx index 5652dde20..e2edc013f 100644 --- a/packages/dropdown/src/DropdownEditor.tsx +++ b/packages/dropdown/src/DropdownEditor.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; -import { Select } from '@contentful/f36-components'; +import { Select } from '@contentful/f36-forms'; import { FieldAPI, FieldConnector, @@ -8,8 +8,8 @@ import { LocalesAPI, } from '@contentful/field-editor-shared'; -import { getOptions, parseValue } from './dropdownUtils'; -import * as styles from './styles'; +import { getOptions, parseValue } from './dropdownUtils.js'; +import * as styles from './styles.js'; export interface DropdownEditorProps { /** diff --git a/packages/dropdown/src/index.tsx b/packages/dropdown/src/index.tsx index 5f46de7c9..0cf3f66d8 100644 --- a/packages/dropdown/src/index.tsx +++ b/packages/dropdown/src/index.tsx @@ -1,2 +1,2 @@ -export { DropdownEditor } from './DropdownEditor'; -export { getOptions, parseValue } from './dropdownUtils'; +export { DropdownEditor } from './DropdownEditor.js'; +export { getOptions, parseValue } from './dropdownUtils.js'; diff --git a/packages/dropdown/tsconfig.json b/packages/dropdown/tsconfig.json index dd2fdf530..c5eb62a8e 100644 --- a/packages/dropdown/tsconfig.json +++ b/packages/dropdown/tsconfig.json @@ -2,9 +2,8 @@ "extends": "../../tsconfig.json", "include": ["src", "types"], "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", - "moduleResolution": "bundler", + "module": "Node16", + "moduleResolution": "Node16", "lib": ["dom", "esnext"], "rootDir": "./src", "baseUrl": "./", diff --git a/packages/json/.eslintrc.js b/packages/json/.eslintrc.cjs similarity index 100% rename from packages/json/.eslintrc.js rename to packages/json/.eslintrc.cjs diff --git a/packages/json/jest.config.js b/packages/json/jest.config.js index 2da53fcff..e45650499 100644 --- a/packages/json/jest.config.js +++ b/packages/json/jest.config.js @@ -1,10 +1,9 @@ /* eslint-disable */ +const baseConfig = require('../../baseESMJestConfig.js'); -const baseConfig = require('../../baseJestConfig'); +const packageJSON = require('./package.json'); +const packageName = packageJSON.name.split('@contentful/')[1]; -const package = require('./package.json'); -const packageName = package.name.split('@contentful/')[1]; - -module.exports = { +export default { ...baseConfig(packageName), }; diff --git a/packages/json/package.json b/packages/json/package.json index b467a0083..ea6c4913b 100644 --- a/packages/json/package.json +++ b/packages/json/package.json @@ -1,17 +1,9 @@ { "name": "@contentful/field-editor-json", "version": "3.3.6", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "type": "module", + "main": "dist/esm/index.js", "types": "dist/types/index.d.ts", - "exports": { - ".": { - "types": "./dist/types/index.d.ts", - "require": "./dist/cjs/index.js", - "default": "./dist/esm/index.js" - }, - "./package.json": "./package.json" - }, "files": [ "dist" ], @@ -23,12 +15,10 @@ }, "scripts": { "watch": "yarn concurrently \"yarn:watch:*\"", - "watch:cjs": "yarn build:cjs -w", "watch:esm": "yarn build:esm -w", "watch:types": "yarn build:types --watch", - "build": "yarn build:types && yarn build:cjs && yarn build:esm", + "build": "yarn build:types && yarn build:esm", "build:types": "tsc --outDir dist/types --emitDeclarationOnly", - "build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs", "build:esm": "swc src --config-file ../../.swcrc -d dist/esm", "tsc": "tsc -p ./ --noEmit" }, @@ -38,13 +28,14 @@ "@contentful/f36-tokens": "^4.0.0", "@contentful/field-editor-shared": "^1.4.2", "@types/deep-equal": "1.0.1", - "@types/react-codemirror": "1.0.3", - "@uiw/react-codemirror": "^4.11.4", + "@types/react-codemirror": "1.0.10", + "@uiw/react-codemirror": "^4.21.20", "deep-equal": "2.2.2", "emotion": "^10.0.17", "lodash": "^4.17.15" }, "devDependencies": { + "@types/lodash-es": "4.17.9", "@contentful/field-editor-test-utils": "^1.4.3" }, "peerDependencies": { diff --git a/packages/json/src/JsonEditor.tsx b/packages/json/src/JsonEditor.tsx index e1fdfa27a..abe399d25 100644 --- a/packages/json/src/JsonEditor.tsx +++ b/packages/json/src/JsonEditor.tsx @@ -2,13 +2,13 @@ import * as React from 'react'; import { FieldAPI, FieldConnector } from '@contentful/field-editor-shared'; import deepEqual from 'deep-equal'; -import throttle from 'lodash/throttle'; +import throttle from 'lodash-es/throttle.js'; -import { JsonEditorField } from './JsonEditorField'; -import { JsonEditorToolbar } from './JsonEditorToolbar'; -import { JsonInvalidStatus } from './JsonInvalidStatus'; -import { JSONObject } from './types'; -import { stringifyJSON, parseJSON, SPACE_INDENT_COUNT } from './utils'; +import { JsonEditorField } from './JsonEditorField.js'; +import { JsonEditorToolbar } from './JsonEditorToolbar.js'; +import { JsonInvalidStatus } from './JsonInvalidStatus.js'; +import { JSONObject } from './types.js'; +import { stringifyJSON, parseJSON, SPACE_INDENT_COUNT } from './utils.js'; export interface JsonEditorProps { /** diff --git a/packages/json/src/JsonEditorField.tsx b/packages/json/src/JsonEditorField.tsx index a11d039b1..c2a2f46b3 100644 --- a/packages/json/src/JsonEditorField.tsx +++ b/packages/json/src/JsonEditorField.tsx @@ -4,10 +4,10 @@ import { json } from '@codemirror/lang-json'; import { indentUnit } from '@codemirror/language'; import { EditorView } from '@codemirror/view'; import tokens from '@contentful/f36-tokens'; -import CodeMirror from '@uiw/react-codemirror'; +import CodeMirror from '@uiw/react-codemirror/esm/index.js'; import { css, cx } from 'emotion'; -import { SPACE_INDENT_COUNT } from './utils'; +import { SPACE_INDENT_COUNT } from './utils.js'; type JsonEditorFieldProps = { isDisabled: boolean; @@ -60,6 +60,7 @@ export function JsonEditorField(props: JsonEditorFieldProps) { className={cx(styles.root, { disabled: props.isDisabled })} data-test-id="json-editor-code-mirror" > + {/* @ts-expect-error */} =16.8.0" diff --git a/packages/list/src/ListEditor.spec.tsx b/packages/list/src/ListEditor.spec.tsx index c9a0a9e99..e2741a609 100644 --- a/packages/list/src/ListEditor.spec.tsx +++ b/packages/list/src/ListEditor.spec.tsx @@ -1,10 +1,11 @@ import * as React from 'react'; import { createFakeFieldAPI, createFakeLocalesAPI } from '@contentful/field-editor-test-utils'; +import { jest } from '@jest/globals'; import '@testing-library/jest-dom/extend-expect'; import { RenderResult, cleanup, configure, fireEvent, render } from '@testing-library/react'; -import { ListEditor } from './ListEditor'; +import { ListEditor } from './ListEditor.js'; configure({ testIdAttribute: 'data-test-id', diff --git a/packages/list/src/ListEditor.tsx b/packages/list/src/ListEditor.tsx index 22eab4f5e..4ffbce014 100644 --- a/packages/list/src/ListEditor.tsx +++ b/packages/list/src/ListEditor.tsx @@ -1,11 +1,11 @@ import * as React from 'react'; -import { TextInput } from '@contentful/f36-components'; +import { TextInput } from '@contentful/f36-forms'; import { FieldAPI, FieldConnector, LocalesAPI } from '@contentful/field-editor-shared'; import { FieldConnectorChildProps } from '@contentful/field-editor-shared'; -import isEqual from 'lodash/isEqual'; +import isEqual from 'lodash-es/isEqual.js'; -import * as styles from './styles'; +import * as styles from './styles.js'; export interface ListEditorProps { /** diff --git a/packages/list/src/index.tsx b/packages/list/src/index.tsx index 4cec70f86..4e0d31da4 100644 --- a/packages/list/src/index.tsx +++ b/packages/list/src/index.tsx @@ -1 +1 @@ -export { ListEditor } from './ListEditor'; +export { ListEditor } from './ListEditor.js'; diff --git a/packages/list/tsconfig.json b/packages/list/tsconfig.json index 7908b1848..c5eb62a8e 100644 --- a/packages/list/tsconfig.json +++ b/packages/list/tsconfig.json @@ -2,8 +2,8 @@ "extends": "../../tsconfig.json", "include": ["src", "types"], "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", + "module": "Node16", + "moduleResolution": "Node16", "lib": ["dom", "esnext"], "rootDir": "./src", "baseUrl": "./", diff --git a/packages/location/.eslintrc.js b/packages/location/.eslintrc.cjs similarity index 100% rename from packages/location/.eslintrc.js rename to packages/location/.eslintrc.cjs diff --git a/packages/location/jest.config.js b/packages/location/jest.config.js index 2da53fcff..c0b29bf39 100644 --- a/packages/location/jest.config.js +++ b/packages/location/jest.config.js @@ -1,10 +1,8 @@ -/* eslint-disable */ +import baseConfig from '../../baseESMJestConfig.js'; +import packageJSON from './package.json' assert { type: 'json' }; -const baseConfig = require('../../baseJestConfig'); +const packageName = packageJSON.name.split('@contentful/')[1]; -const package = require('./package.json'); -const packageName = package.name.split('@contentful/')[1]; - -module.exports = { +export default { ...baseConfig(packageName), }; diff --git a/packages/location/package.json b/packages/location/package.json index d990b79e1..f90f84501 100644 --- a/packages/location/package.json +++ b/packages/location/package.json @@ -1,17 +1,9 @@ { "name": "@contentful/field-editor-location", "version": "1.3.5", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "type": "module", + "main": "dist/esm/index.js", "types": "dist/types/index.d.ts", - "exports": { - ".": { - "types": "./dist/types/index.d.ts", - "require": "./dist/cjs/index.js", - "default": "./dist/cjs/index.js" - }, - "./package.json": "./package.json" - }, "files": [ "dist" ], @@ -23,12 +15,10 @@ }, "scripts": { "watch": "yarn concurrently \"yarn:watch:*\"", - "watch:cjs": "yarn build:cjs -w", "watch:esm": "yarn build:esm -w", "watch:types": "yarn build:types --watch", - "build": "yarn build:types && yarn build:cjs && yarn build:esm", + "build": "yarn build:types && yarn build:esm", "build:types": "tsc --outDir dist/types --emitDeclarationOnly", - "build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs", "build:esm": "swc src --config-file ../../.swcrc -d dist/esm", "tsc": "tsc -p ./ --noEmit" }, @@ -43,7 +33,8 @@ "lodash": "^4.17.15" }, "devDependencies": { - "@contentful/field-editor-test-utils": "^1.4.3" + "@contentful/field-editor-test-utils": "^1.4.3", + "@jest/globals": "29.7.0" }, "peerDependencies": { "react": ">=16.8.0" diff --git a/packages/location/src/GoogleMapView.tsx b/packages/location/src/GoogleMapView.tsx index d70dbbe03..f1964eed1 100644 --- a/packages/location/src/GoogleMapView.tsx +++ b/packages/location/src/GoogleMapView.tsx @@ -5,7 +5,7 @@ import * as React from 'react'; import { css } from 'emotion'; import GoogleMapReact from 'google-map-react'; -import { Coords } from './types'; +import { Coords } from './types.js'; const styles = { root: css({ diff --git a/packages/location/src/LocationEditor.tsx b/packages/location/src/LocationEditor.tsx index c2025dc65..53178378a 100644 --- a/packages/location/src/LocationEditor.tsx +++ b/packages/location/src/LocationEditor.tsx @@ -2,18 +2,18 @@ import * as React from 'react'; import { FieldAPI, FieldConnector, ParametersAPI } from '@contentful/field-editor-shared'; import deepEqual from 'deep-equal'; -import isNumber from 'lodash/isNumber'; -import throttle from 'lodash/throttle'; +import isNumber from 'lodash-es/isNumber.js'; +import throttle from 'lodash-es/throttle.js'; -import { GoogleMapView } from './GoogleMapView'; -import { LocationSelector } from './LocationSelector'; +import { GoogleMapView } from './GoogleMapView.js'; +import { LocationSelector } from './LocationSelector.js'; import { LocationValue, ViewType, NullableLocationValue, Coords, GeocodeApiResponse, -} from './types'; +} from './types.js'; export interface LocationEditorConnectedProps { /** diff --git a/packages/location/src/LocationSearchInput.tsx b/packages/location/src/LocationSearchInput.tsx index ef8e7c1f6..5b873cda1 100644 --- a/packages/location/src/LocationSearchInput.tsx +++ b/packages/location/src/LocationSearchInput.tsx @@ -4,7 +4,7 @@ import { Button, Card, Spinner, TextInput, ValidationMessage } from '@contentful import tokens from '@contentful/f36-tokens'; import { css } from 'emotion'; -import { Coords, GeocodeApiResponse } from './types'; +import { Coords, GeocodeApiResponse } from './types.js'; const styles = { root: css({ diff --git a/packages/location/src/LocationSelector.tsx b/packages/location/src/LocationSelector.tsx index 25a84d456..08eae3b0f 100644 --- a/packages/location/src/LocationSelector.tsx +++ b/packages/location/src/LocationSelector.tsx @@ -4,8 +4,8 @@ import { Flex, Radio, TextInput, TextLink } from '@contentful/f36-components'; import tokens from '@contentful/f36-tokens'; import { css } from 'emotion'; -import { LocationSearchInput } from './LocationSearchInput'; -import { Coords, GeocodeApiResponse, ViewType } from './types'; +import { LocationSearchInput } from './LocationSearchInput.js'; +import { Coords, GeocodeApiResponse, ViewType } from './types.js'; interface LocationSelectorProps { disabled: boolean; diff --git a/packages/location/src/index.tsx b/packages/location/src/index.tsx index b4f045127..e2645bf68 100644 --- a/packages/location/src/index.tsx +++ b/packages/location/src/index.tsx @@ -1,3 +1,3 @@ -import { LocationEditorConnected } from './LocationEditor'; +import { LocationEditorConnected } from './LocationEditor.js'; export const LocationEditor = LocationEditorConnected; diff --git a/packages/location/tsconfig.json b/packages/location/tsconfig.json index 7908b1848..c5eb62a8e 100644 --- a/packages/location/tsconfig.json +++ b/packages/location/tsconfig.json @@ -2,8 +2,8 @@ "extends": "../../tsconfig.json", "include": ["src", "types"], "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", + "module": "Node16", + "moduleResolution": "Node16", "lib": ["dom", "esnext"], "rootDir": "./src", "baseUrl": "./", diff --git a/packages/markdown/.eslintrc.js b/packages/markdown/.eslintrc.cjs similarity index 100% rename from packages/markdown/.eslintrc.js rename to packages/markdown/.eslintrc.cjs diff --git a/packages/markdown/jest.config.js b/packages/markdown/jest.config.js index 2da53fcff..c0b29bf39 100644 --- a/packages/markdown/jest.config.js +++ b/packages/markdown/jest.config.js @@ -1,10 +1,8 @@ -/* eslint-disable */ +import baseConfig from '../../baseESMJestConfig.js'; +import packageJSON from './package.json' assert { type: 'json' }; -const baseConfig = require('../../baseJestConfig'); +const packageName = packageJSON.name.split('@contentful/')[1]; -const package = require('./package.json'); -const packageName = package.name.split('@contentful/')[1]; - -module.exports = { +export default { ...baseConfig(packageName), }; diff --git a/packages/markdown/package.json b/packages/markdown/package.json index 09f754c8a..6f73a58e1 100644 --- a/packages/markdown/package.json +++ b/packages/markdown/package.json @@ -1,17 +1,9 @@ { "name": "@contentful/field-editor-markdown", "version": "1.5.3", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "type": "module", + "main": "dist/esm/index.js", "types": "dist/types/index.d.ts", - "exports": { - ".": { - "types": "./dist/types/index.d.ts", - "require": "./dist/cjs/index.js", - "default": "./dist/cjs/index.js" - }, - "./package.json": "./package.json" - }, "files": [ "dist" ], @@ -23,12 +15,10 @@ }, "scripts": { "watch": "yarn concurrently \"yarn:watch:*\"", - "watch:cjs": "yarn build:cjs -w", "watch:esm": "yarn build:esm -w", "watch:types": "yarn build:types --watch", - "build": "yarn build:types && yarn build:cjs && yarn build:esm", - "build:types": "tsc --outDir dist/types --emitDeclarationOnly", - "build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs", + "build": "yarn build:types && yarn build:esm", + "build:types": "tsc --outDir dist/types --emitDeclarationOnly --resolveJsonModule", "build:esm": "swc src --config-file ../../.swcrc -d dist/esm", "test": "jest --watch", "test:ci": "jest --ci", @@ -52,7 +42,8 @@ "devDependencies": { "@babel/core": "^7.5.5", "@contentful/app-sdk": "^4.17.1", - "@contentful/field-editor-test-utils": "^1.4.3" + "@contentful/field-editor-test-utils": "^1.4.3", + "@jest/globals": "29.7.0" }, "peerDependencies": { "@contentful/app-sdk": "^4.17.1", diff --git a/packages/markdown/src/MarkdownActions.ts b/packages/markdown/src/MarkdownActions.ts index 9ea04becd..acc3a8f0c 100644 --- a/packages/markdown/src/MarkdownActions.ts +++ b/packages/markdown/src/MarkdownActions.ts @@ -1,14 +1,14 @@ import { KnownSDK } from '@contentful/app-sdk'; -import { InitializedEditorType } from './components/MarkdownTextarea/MarkdownTextarea'; -import { openConfirmInsertAsset } from './dialogs/ConfirmInsertAssetModalDialog'; -import { openEmbedExternalContentDialog } from './dialogs/EmdebExternalContentDialog'; -import { openInsertLinkDialog } from './dialogs/InsertLinkModalDialog'; -import { openInsertTableDialog } from './dialogs/InsertTableModalDialog'; -import { openInsertSpecialCharacter } from './dialogs/SpecialCharacterModalDialog'; -import { openZenMode } from './dialogs/ZenModeModalDialog'; -import { insertAssetLinks } from './utils/insertAssetLinks'; -import * as LinkOrganizer from './utils/linkOrganizer'; +import { InitializedEditorType } from './components/MarkdownTextarea/MarkdownTextarea.js'; +import { openConfirmInsertAsset } from './dialogs/ConfirmInsertAssetModalDialog.js'; +import { openEmbedExternalContentDialog } from './dialogs/EmdebExternalContentDialog.js'; +import { openInsertLinkDialog } from './dialogs/InsertLinkModalDialog.js'; +import { openInsertTableDialog } from './dialogs/InsertTableModalDialog.js'; +import { openInsertSpecialCharacter } from './dialogs/SpecialCharacterModalDialog.js'; +import { openZenMode } from './dialogs/ZenModeModalDialog.js'; +import { insertAssetLinks } from './utils/insertAssetLinks.js'; +import * as LinkOrganizer from './utils/linkOrganizer.js'; export function createMarkdownActions(props: { sdk: KnownSDK; diff --git a/packages/markdown/src/MarkdownEditor.tsx b/packages/markdown/src/MarkdownEditor.tsx index 5e20043b3..9abc312af 100644 --- a/packages/markdown/src/MarkdownEditor.tsx +++ b/packages/markdown/src/MarkdownEditor.tsx @@ -5,20 +5,20 @@ import tokens from '@contentful/f36-tokens'; import { FieldConnector } from '@contentful/field-editor-shared'; import { css } from 'emotion'; -import { MarkdownBottomBar, MarkdownHelp } from './components/MarkdownBottomBar'; -import { MarkdownConstraints } from './components/MarkdownConstraints'; -import MarkdownPreviewSkeleton from './components/MarkdownPreviewSkeleton'; -import { MarkdownTabs } from './components/MarkdownTabs'; +import { MarkdownBottomBar, MarkdownHelp } from './components/MarkdownBottomBar.js'; +import { MarkdownConstraints } from './components/MarkdownConstraints.js'; +import MarkdownPreviewSkeleton from './components/MarkdownPreviewSkeleton.js'; +import { MarkdownTabs } from './components/MarkdownTabs.js'; import { InitializedEditorType, MarkdownTextarea, -} from './components/MarkdownTextarea/MarkdownTextarea'; -import { MarkdownToolbar } from './components/MarkdownToolbar'; -import { openCheatsheetModal } from './dialogs/CheatsheetModalDialog'; -import { createMarkdownActions } from './MarkdownActions'; -import { MarkdownTab, PreviewComponents } from './types'; +} from './components/MarkdownTextarea/MarkdownTextarea.js'; +import { MarkdownToolbar } from './components/MarkdownToolbar.js'; +import { openCheatsheetModal } from './dialogs/CheatsheetModalDialog.js'; +import { createMarkdownActions } from './MarkdownActions.js'; +import { MarkdownTab, PreviewComponents } from './types.js'; -const MarkdownPreview = React.lazy(() => import('./components/MarkdownPreview')); +const MarkdownPreview = React.lazy(() => import('./components/MarkdownPreview.js')); const styles = { container: css({ diff --git a/packages/markdown/src/__fixtures__/FakeSdk.ts b/packages/markdown/src/__fixtures__/FakeSdk.ts index 81d4d0343..f8f1b59e4 100644 --- a/packages/markdown/src/__fixtures__/FakeSdk.ts +++ b/packages/markdown/src/__fixtures__/FakeSdk.ts @@ -8,7 +8,7 @@ import { import { CollectionProp, GetSpaceParams, LocaleProps } from 'contentful-management'; import { Emitter } from 'mitt'; -import { assets, contentTypes, entries, locales as localesFixtures, spaces } from './fixtures'; +import { assets, contentTypes, entries, locales as localesFixtures, spaces } from './fixtures.js'; const newLink = (linkType: string, id: string): Link => ({ sys: { diff --git a/packages/markdown/src/__fixtures__/fixtures.ts b/packages/markdown/src/__fixtures__/fixtures.ts index 7093a061e..2b62f1258 100644 --- a/packages/markdown/src/__fixtures__/fixtures.ts +++ b/packages/markdown/src/__fixtures__/fixtures.ts @@ -1,7 +1,7 @@ -import * as assets from './asset'; -import * as contentTypes from './content-type'; -import * as entries from './entry'; -import * as locales from './locale'; -import * as spaces from './space'; +import * as assets from './asset/index.js'; +import * as contentTypes from './content-type/index.js'; +import * as entries from './entry/index.js'; +import * as locales from './locale/index.js'; +import * as spaces from './space/index.js'; export { assets, contentTypes, entries, locales, spaces }; diff --git a/packages/markdown/src/components/HeadingSelector.tsx b/packages/markdown/src/components/HeadingSelector.tsx index a7c6e09d0..b6e1b267c 100644 --- a/packages/markdown/src/components/HeadingSelector.tsx +++ b/packages/markdown/src/components/HeadingSelector.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { Menu } from '@contentful/f36-components'; -import { HeadingType } from '../types'; +import { HeadingType } from '../types.js'; export const HeadingSelector = (props: { children: React.ReactElement; diff --git a/packages/markdown/src/components/MarkdownBottomBar.tsx b/packages/markdown/src/components/MarkdownBottomBar.tsx index 353414164..ffbe0ccb2 100644 --- a/packages/markdown/src/components/MarkdownBottomBar.tsx +++ b/packages/markdown/src/components/MarkdownBottomBar.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import { Paragraph, Stack, TextLink } from '@contentful/f36-components'; import tokens from '@contentful/f36-tokens'; import { css } from 'emotion'; -import { MarkdownTab } from 'types'; +import { MarkdownTab } from 'types.js'; const SANITIZE_LINK = 'https://en.wikipedia.org/wiki/HTML_sanitization'; diff --git a/packages/markdown/src/components/MarkdownPreview.tsx b/packages/markdown/src/components/MarkdownPreview.tsx index 4bf1a4aed..3af051b70 100644 --- a/packages/markdown/src/components/MarkdownPreview.tsx +++ b/packages/markdown/src/components/MarkdownPreview.tsx @@ -7,8 +7,8 @@ import rehypeRaw from 'rehype-raw'; import rehypeSanitize from 'rehype-sanitize'; import remarkGfm from 'remark-gfm'; -import { EditorDirection, PreviewComponents } from '../types'; -import { replaceMailtoAmp } from '../utils/replaceMailtoAmp'; +import { EditorDirection, PreviewComponents } from '../types.js'; +import { replaceMailtoAmp } from '../utils/replaceMailtoAmp.js'; const styles = { root: css` diff --git a/packages/markdown/src/components/MarkdownTabs.tsx b/packages/markdown/src/components/MarkdownTabs.tsx index 2834c6e7a..ca73b048b 100644 --- a/packages/markdown/src/components/MarkdownTabs.tsx +++ b/packages/markdown/src/components/MarkdownTabs.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import tokens from '@contentful/f36-tokens'; import { css, cx } from 'emotion'; -import { MarkdownTab } from '../types'; +import { MarkdownTab } from '../types.js'; const styles = { root: css({ diff --git a/packages/markdown/src/components/MarkdownTextarea/CodeMirrorWrapper.ts b/packages/markdown/src/components/MarkdownTextarea/CodeMirrorWrapper.ts index 26ebe93f8..8e93db5be 100644 --- a/packages/markdown/src/components/MarkdownTextarea/CodeMirrorWrapper.ts +++ b/packages/markdown/src/components/MarkdownTextarea/CodeMirrorWrapper.ts @@ -2,11 +2,11 @@ import CodeMirror from 'codemirror'; import 'codemirror/addon/edit/matchbrackets'; -import throttle from 'lodash/throttle'; -import transform from 'lodash/transform'; +import throttle from 'lodash-es/throttle.js'; +import transform from 'lodash-es/transform.js'; -import { EditorDirection } from '../../types'; -import * as userAgent from '../../utils/userAgent'; +import { EditorDirection } from '../../types.js'; +import * as userAgent from '../../utils/userAgent.js'; function stripUnit(value: number | string): number { if (typeof value !== 'string') return value; @@ -44,6 +44,7 @@ export function create( shift: 50, }; + // @ts-expect-error const cm = CodeMirror(host, { direction, readOnly, diff --git a/packages/markdown/src/components/MarkdownTextarea/MarkdownCommands.ts b/packages/markdown/src/components/MarkdownTextarea/MarkdownCommands.ts index 7d1af86fc..26af09b37 100644 --- a/packages/markdown/src/components/MarkdownTextarea/MarkdownCommands.ts +++ b/packages/markdown/src/components/MarkdownTextarea/MarkdownCommands.ts @@ -1,13 +1,13 @@ /* eslint-disable @typescript-eslint/no-use-before-define */ -import max from 'lodash/max'; -import min from 'lodash/min'; -import range from 'lodash/range'; -import times from 'lodash/times'; +import max from 'lodash-es/max.js'; +import min from 'lodash-es/min.js'; +import range from 'lodash-es/range.js'; +import times from 'lodash-es/times.js'; // eslint-disable-next-line -- TODO: describe this disable you-dont-need-lodash-underscore/repeat -import repeat from 'lodash/repeat'; +import repeat from 'lodash-es/repeat.js'; -import * as CodeMirrorWrapper from './CodeMirrorWrapper'; +import * as CodeMirrorWrapper from './CodeMirrorWrapper.js'; type EditorInstanceType = ReturnType; diff --git a/packages/markdown/src/components/MarkdownTextarea/MarkdownTextarea.tsx b/packages/markdown/src/components/MarkdownTextarea/MarkdownTextarea.tsx index 91f20cc99..d72467144 100644 --- a/packages/markdown/src/components/MarkdownTextarea/MarkdownTextarea.tsx +++ b/packages/markdown/src/components/MarkdownTextarea/MarkdownTextarea.tsx @@ -3,8 +3,8 @@ import React, { useRef, useEffect, useState } from 'react'; import tokens from '@contentful/f36-tokens'; import { css, cx } from 'emotion'; -import { EditorDirection } from '../../types'; -import { createMarkdownEditor } from './createMarkdownEditor'; +import { EditorDirection } from '../../types.js'; +import { createMarkdownEditor } from './createMarkdownEditor.js'; export type InitializedEditorType = ReturnType; diff --git a/packages/markdown/src/components/MarkdownTextarea/createMarkdownEditor.ts b/packages/markdown/src/components/MarkdownTextarea/createMarkdownEditor.ts index f7bab6738..bb478074a 100644 --- a/packages/markdown/src/components/MarkdownTextarea/createMarkdownEditor.ts +++ b/packages/markdown/src/components/MarkdownTextarea/createMarkdownEditor.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { EditorDirection } from '../../types'; -import * as CodeMirrorWrapper from './CodeMirrorWrapper'; -import * as Commands from './MarkdownCommands'; +import { EditorDirection } from '../../types.js'; +import * as CodeMirrorWrapper from './CodeMirrorWrapper.js'; +import * as Commands from './MarkdownCommands.js'; export function createMarkdownEditor( host: HTMLElement, diff --git a/packages/markdown/src/components/MarkdownToolbar.tsx b/packages/markdown/src/components/MarkdownToolbar.tsx index 1b909e4d8..e064ae2ba 100644 --- a/packages/markdown/src/components/MarkdownToolbar.tsx +++ b/packages/markdown/src/components/MarkdownToolbar.tsx @@ -18,10 +18,10 @@ import { import tokens from '@contentful/f36-tokens'; import { css, cx } from 'emotion'; -import { MarkdownActions } from '../types'; -import { HeadingSelector } from './HeadingSelector'; -import * as Icons from './icons'; -import { InsertLinkSelector } from './InsertLinkSelector'; +import { MarkdownActions } from '../types.js'; +import { HeadingSelector } from './HeadingSelector.js'; +import * as Icons from './icons.js'; +import { InsertLinkSelector } from './InsertLinkSelector.js'; const styles = { root: css({ diff --git a/packages/markdown/src/dialogs/CheatsheetModalDialog.tsx b/packages/markdown/src/dialogs/CheatsheetModalDialog.tsx index 60e093ef7..b32e52810 100644 --- a/packages/markdown/src/dialogs/CheatsheetModalDialog.tsx +++ b/packages/markdown/src/dialogs/CheatsheetModalDialog.tsx @@ -5,7 +5,7 @@ import { Heading, ModalContent, TextLink } from '@contentful/f36-components'; import tokens from '@contentful/f36-tokens'; import { css, cx } from 'emotion'; -import { MarkdownDialogType, MarkdownDialogsParams } from '../types'; +import { MarkdownDialogType, MarkdownDialogsParams } from '../types.js'; const styles = { flexColumnContainer: css({ diff --git a/packages/markdown/src/dialogs/ConfirmInsertAssetModalDialog.tsx b/packages/markdown/src/dialogs/ConfirmInsertAssetModalDialog.tsx index 4ea03e9e1..f6a0b7a0b 100644 --- a/packages/markdown/src/dialogs/ConfirmInsertAssetModalDialog.tsx +++ b/packages/markdown/src/dialogs/ConfirmInsertAssetModalDialog.tsx @@ -9,7 +9,7 @@ import { Paragraph, } from '@contentful/f36-components'; -import { MarkdownDialogType, MarkdownDialogsParams } from '../types'; +import { MarkdownDialogType, MarkdownDialogsParams } from '../types.js'; interface ConfirmInsertAssetModalDialogProps { onClose: (result: boolean) => void; diff --git a/packages/markdown/src/dialogs/EmdebExternalContentDialog.tsx b/packages/markdown/src/dialogs/EmdebExternalContentDialog.tsx index 5eb3deda6..283a1c07d 100644 --- a/packages/markdown/src/dialogs/EmdebExternalContentDialog.tsx +++ b/packages/markdown/src/dialogs/EmdebExternalContentDialog.tsx @@ -16,8 +16,8 @@ import { import tokens from '@contentful/f36-tokens'; import { css } from 'emotion'; -import { MarkdownDialogType, MarkdownDialogsParams } from '../types'; -import { isValidUrl } from '../utils/isValidUrl'; +import { MarkdownDialogType, MarkdownDialogsParams } from '../types.js'; +import { isValidUrl } from '../utils/isValidUrl.js'; const styles = { widthFiledGroup: css({ @@ -109,7 +109,8 @@ export const EmbedExternalContentModal = ({ onClose }: EmbedExternalContentModal + isInvalid={!isWidthValid(Number(width), selectedUnit)} + > Width setUnit('percent')} - className={styles.radioButton}> + className={styles.radioButton} + > percent setUnit('px')} - className={styles.radioButton}> + className={styles.radioButton} + > pixels @@ -151,7 +154,8 @@ export const EmbedExternalContentModal = ({ onClose }: EmbedExternalContentModal value="Yes" isChecked={attachSocial} onChange={() => setAttachSocial(!attachSocial)} - testId="attach-social-checkbox"> + testId="attach-social-checkbox" + > Attach social sharing links to this element @@ -159,7 +163,8 @@ export const EmbedExternalContentModal = ({ onClose }: EmbedExternalContentModal + rel="noopener noreferrer" + > Embedly's platform.js  on your development environment @@ -172,7 +177,8 @@ export const EmbedExternalContentModal = ({ onClose }: EmbedExternalContentModal testId="emded-external-cancel" onClick={() => onClose(false)} variant="secondary" - size="small"> + size="small" + > Cancel diff --git a/packages/markdown/src/dialogs/InsertLinkModalDialog.tsx b/packages/markdown/src/dialogs/InsertLinkModalDialog.tsx index fb2676138..7159b3f2f 100644 --- a/packages/markdown/src/dialogs/InsertLinkModalDialog.tsx +++ b/packages/markdown/src/dialogs/InsertLinkModalDialog.tsx @@ -10,8 +10,8 @@ import { TextInput, } from '@contentful/f36-components'; -import { MarkdownDialogType, MarkdownDialogsParams } from '../types'; -import { isValidUrl } from '../utils/isValidUrl'; +import { MarkdownDialogType, MarkdownDialogsParams } from '../types.js'; +import { isValidUrl } from '../utils/isValidUrl.js'; type InsertLinkModalPositiveResult = { url: string; text: string; title: string }; export type InsertLinkModalResult = InsertLinkModalPositiveResult | false | undefined; @@ -94,7 +94,8 @@ export const InsertLinkModal = ({ selectedText, onClose }: InsertLinkModalProps) testId="insert-link-cancel" onClick={() => onClose(false)} variant="secondary" - size="small"> + size="small" + > Cancel diff --git a/packages/markdown/src/dialogs/InsertTableModalDialog.tsx b/packages/markdown/src/dialogs/InsertTableModalDialog.tsx index ece727b44..ee4434c8b 100644 --- a/packages/markdown/src/dialogs/InsertTableModalDialog.tsx +++ b/packages/markdown/src/dialogs/InsertTableModalDialog.tsx @@ -9,9 +9,9 @@ import { FormControl, TextInput, } from '@contentful/f36-components'; -import inRange from 'lodash/inRange'; +import inRange from 'lodash-es/inRange.js'; -import { MarkdownDialogType, MarkdownDialogsParams } from '../types'; +import { MarkdownDialogType, MarkdownDialogsParams } from '../types.js'; type InsertTableModalPositiveResult = { cols: number; rows: number }; export type InsertTableModalResult = InsertTableModalPositiveResult | false | undefined; @@ -88,7 +88,8 @@ export const InsertTableModal = ({ onClose }: InsertTableModalProps) => { testId="insert-table-cancel" onClick={() => onClose(false)} variant="secondary" - size="small"> + size="small" + > Cancel diff --git a/packages/markdown/src/dialogs/SpecialCharacterModalDialog.tsx b/packages/markdown/src/dialogs/SpecialCharacterModalDialog.tsx index 1abff7989..e0c804550 100644 --- a/packages/markdown/src/dialogs/SpecialCharacterModalDialog.tsx +++ b/packages/markdown/src/dialogs/SpecialCharacterModalDialog.tsx @@ -12,8 +12,8 @@ import { import tokens from '@contentful/f36-tokens'; import { css } from 'emotion'; -import { MarkdownDialogType, MarkdownDialogsParams } from '../types'; -import { specialCharacters } from '../utils/specialCharacters'; +import { MarkdownDialogType, MarkdownDialogsParams } from '../types.js'; +import { specialCharacters } from '../utils/specialCharacters.js'; const styles = { buttonPanel: css({ @@ -68,7 +68,8 @@ export const SpecialCharacterModalDialog = ({ onClose }: SpecialCharacterModalDi isActive={char.code === selectedCharacter.code} className={styles.charButton} variant="transparent" - onClick={() => setSelectedCharacter(char)}> + onClick={() => setSelectedCharacter(char)} + > {String.fromCharCode(char.code)} @@ -82,7 +83,8 @@ export const SpecialCharacterModalDialog = ({ onClose }: SpecialCharacterModalDi className={styles.button} onClick={() => onClose(false)} variant="secondary" - size="small"> + size="small" + > Cancel diff --git a/packages/markdown/src/dialogs/ZenModeModalDialog.tsx b/packages/markdown/src/dialogs/ZenModeModalDialog.tsx index 56e1e2be4..462854bfc 100644 --- a/packages/markdown/src/dialogs/ZenModeModalDialog.tsx +++ b/packages/markdown/src/dialogs/ZenModeModalDialog.tsx @@ -6,18 +6,18 @@ import { ChevronLeftIcon, ChevronRightIcon } from '@contentful/f36-icons'; import tokens from '@contentful/f36-tokens'; import { css, cx } from 'emotion'; -import { MarkdownBottomBar, MarkdownHelp } from '../components/MarkdownBottomBar'; -import MarkdownPreviewSkeleton from '../components/MarkdownPreviewSkeleton'; +import { MarkdownBottomBar, MarkdownHelp } from '../components/MarkdownBottomBar.js'; +import MarkdownPreviewSkeleton from '../components/MarkdownPreviewSkeleton.js'; import { InitializedEditorType, MarkdownTextarea, -} from '../components/MarkdownTextarea/MarkdownTextarea'; -import { MarkdownToolbar } from '../components/MarkdownToolbar'; -import { openCheatsheetModal } from '../dialogs/CheatsheetModalDialog'; -import { createMarkdownActions } from '../MarkdownActions'; -import { MarkdownDialogsParams, MarkdownDialogType, PreviewComponents } from '../types'; +} from '../components/MarkdownTextarea/MarkdownTextarea.js'; +import { MarkdownToolbar } from '../components/MarkdownToolbar.js'; +import { openCheatsheetModal } from '../dialogs/CheatsheetModalDialog.js'; +import { createMarkdownActions } from '../MarkdownActions.js'; +import { MarkdownDialogsParams, MarkdownDialogType, PreviewComponents } from '../types.js'; -const MarkdownPreview = React.lazy(() => import('../components/MarkdownPreview')); +const MarkdownPreview = React.lazy(() => import('../components/MarkdownPreview.js')); export type ZenModeResult = { value: string; diff --git a/packages/markdown/src/dialogs/openMarkdownDialog.tsx b/packages/markdown/src/dialogs/openMarkdownDialog.tsx index 275c4c7ab..82e435f74 100644 --- a/packages/markdown/src/dialogs/openMarkdownDialog.tsx +++ b/packages/markdown/src/dialogs/openMarkdownDialog.tsx @@ -3,17 +3,17 @@ import * as React from 'react'; import { DialogAppSDK, FieldAppSDK, OpenCustomWidgetOptions } from '@contentful/app-sdk'; import { ModalDialogLauncher } from '@contentful/field-editor-shared'; -import { MarkdownDialogType, MarkdownDialogsParams, PreviewComponents } from '../types'; -import { CheatsheetModalDialog } from './CheatsheetModalDialog'; -import { ConfirmInsertAssetModalDialog } from './ConfirmInsertAssetModalDialog'; +import { MarkdownDialogType, MarkdownDialogsParams, PreviewComponents } from '../types.js'; +import { CheatsheetModalDialog } from './CheatsheetModalDialog.js'; +import { ConfirmInsertAssetModalDialog } from './ConfirmInsertAssetModalDialog.js'; import { EmbedExternalContentModal, EmbedExternalContentModalResult, -} from './EmdebExternalContentDialog'; -import { InsertLinkModal, InsertLinkModalResult } from './InsertLinkModalDialog'; -import { InsertTableModal, InsertTableModalResult } from './InsertTableModalDialog'; -import { SpecialCharacterModalDialog } from './SpecialCharacterModalDialog'; -import { ZenModeModalDialog, ZenModeResult } from './ZenModeModalDialog'; +} from './EmdebExternalContentDialog.js'; +import { InsertLinkModal, InsertLinkModalResult } from './InsertLinkModalDialog.js'; +import { InsertTableModal, InsertTableModalResult } from './InsertTableModalDialog.js'; +import { SpecialCharacterModalDialog } from './SpecialCharacterModalDialog.js'; +import { ZenModeModalDialog, ZenModeResult } from './ZenModeModalDialog.js'; export const openMarkdownDialog = (sdk: FieldAppSDK, previewComponents?: PreviewComponents) => diff --git a/packages/markdown/src/dialogs/renderMarkdownDialog.tsx b/packages/markdown/src/dialogs/renderMarkdownDialog.tsx index a9d036f63..a8dd052b5 100644 --- a/packages/markdown/src/dialogs/renderMarkdownDialog.tsx +++ b/packages/markdown/src/dialogs/renderMarkdownDialog.tsx @@ -2,14 +2,14 @@ import * as React from 'react'; import { DialogAppSDK } from '@contentful/app-sdk'; -import { MarkdownDialogsParams, MarkdownDialogType } from '../types'; -import { CheatsheetModalDialog } from './CheatsheetModalDialog'; -import { ConfirmInsertAssetModalDialog } from './ConfirmInsertAssetModalDialog'; -import { EmbedExternalContentModal } from './EmdebExternalContentDialog'; -import { InsertLinkModal } from './InsertLinkModalDialog'; -import { InsertTableModal } from './InsertTableModalDialog'; -import { SpecialCharacterModalDialog } from './SpecialCharacterModalDialog'; -import { ZenModeModalDialog } from './ZenModeModalDialog'; +import { MarkdownDialogsParams, MarkdownDialogType } from '../types.js'; +import { CheatsheetModalDialog } from './CheatsheetModalDialog.js'; +import { ConfirmInsertAssetModalDialog } from './ConfirmInsertAssetModalDialog.js'; +import { EmbedExternalContentModal } from './EmdebExternalContentDialog.js'; +import { InsertLinkModal } from './InsertLinkModalDialog.js'; +import { InsertTableModal } from './InsertTableModalDialog.js'; +import { SpecialCharacterModalDialog } from './SpecialCharacterModalDialog.js'; +import { ZenModeModalDialog } from './ZenModeModalDialog.js'; export const renderMarkdownDialog = ( sdk: DialogAppSDK & { parameters: { invocation: MarkdownDialogsParams } } diff --git a/packages/markdown/src/index.tsx b/packages/markdown/src/index.tsx index 2ae3e8ca0..c5a74667f 100644 --- a/packages/markdown/src/index.tsx +++ b/packages/markdown/src/index.tsx @@ -1,6 +1,6 @@ import './codemirrorImports'; -export { MarkdownEditorConnected as MarkdownEditor } from './MarkdownEditor'; -export { default as MarkdownPreview } from './components/MarkdownPreview'; -export { openMarkdownDialog } from './dialogs/openMarkdownDialog'; -export { renderMarkdownDialog } from './dialogs/renderMarkdownDialog'; +export { MarkdownEditorConnected as MarkdownEditor } from './MarkdownEditor.js'; +export { default as MarkdownPreview } from './components/MarkdownPreview.js'; +export { openMarkdownDialog } from './dialogs/openMarkdownDialog.js'; +export { renderMarkdownDialog } from './dialogs/renderMarkdownDialog.js'; diff --git a/packages/markdown/src/utils/insertAssetLinks.spec.ts b/packages/markdown/src/utils/insertAssetLinks.spec.ts index e6c03c480..5a6e1d36a 100644 --- a/packages/markdown/src/utils/insertAssetLinks.spec.ts +++ b/packages/markdown/src/utils/insertAssetLinks.spec.ts @@ -1,4 +1,4 @@ -import { replaceAssetDomain } from './insertAssetLinks'; +import { replaceAssetDomain } from './insertAssetLinks.js'; describe('replaceAssetDomain', () => { it('should replace contentful.com domains to ctfassets.net', () => { diff --git a/packages/markdown/src/utils/insertAssetLinks.ts b/packages/markdown/src/utils/insertAssetLinks.ts index ba29fb9a3..69a553f57 100644 --- a/packages/markdown/src/utils/insertAssetLinks.ts +++ b/packages/markdown/src/utils/insertAssetLinks.ts @@ -1,5 +1,5 @@ -import get from 'lodash/get'; -import isObject from 'lodash/isObject'; +import get from 'lodash-es/get.js'; +import isObject from 'lodash-es/isObject.js'; // eslint-disable-next-line -- TODO: describe this disable @typescript-eslint/no-explicit-any type Asset = any; diff --git a/packages/markdown/src/utils/linkOrganizer.spec.ts b/packages/markdown/src/utils/linkOrganizer.spec.ts index 8490294e0..1985d446d 100644 --- a/packages/markdown/src/utils/linkOrganizer.spec.ts +++ b/packages/markdown/src/utils/linkOrganizer.spec.ts @@ -1,4 +1,4 @@ -import * as LinkOrganizer from './linkOrganizer'; +import * as LinkOrganizer from './linkOrganizer.js'; describe('Link organizer', () => { describe('Inline link finder', () => { diff --git a/packages/markdown/src/utils/linkOrganizer.ts b/packages/markdown/src/utils/linkOrganizer.ts index aa21e9aa3..38c66513d 100644 --- a/packages/markdown/src/utils/linkOrganizer.ts +++ b/packages/markdown/src/utils/linkOrganizer.ts @@ -1,13 +1,13 @@ /* eslint-disable @typescript-eslint/no-use-before-define, @typescript-eslint/no-explicit-any */ -import extend from 'lodash/extend'; -import isObject from 'lodash/isObject'; -import isString from 'lodash/isString'; -import max from 'lodash/max'; +import extend from 'lodash-es/extend.js'; +import isObject from 'lodash-es/isObject.js'; +import isString from 'lodash-es/isString.js'; +import max from 'lodash-es/max.js'; // eslint-disable-next-line -- TODO: describe this disable -import isFinite from 'lodash/isFinite'; +import isFinite from 'lodash-es/isFinite.js'; // eslint-disable-next-line -- TODO: describe this disable -import forEach from 'lodash/forEach'; +import forEach from 'lodash-es/forEach.js'; function extractTitle(title: string) { title = title || ''; diff --git a/packages/markdown/src/utils/replaceMailtoAmp.spec.ts b/packages/markdown/src/utils/replaceMailtoAmp.spec.ts index f2bd64cc8..d7f016d32 100644 --- a/packages/markdown/src/utils/replaceMailtoAmp.spec.ts +++ b/packages/markdown/src/utils/replaceMailtoAmp.spec.ts @@ -1,4 +1,4 @@ -import { replaceMailtoAmp } from './replaceMailtoAmp'; +import { replaceMailtoAmp } from './replaceMailtoAmp.js'; describe('replace inside mailto', () => { let str = diff --git a/packages/markdown/src/utils/userAgent.ts b/packages/markdown/src/utils/userAgent.ts index 1e1132831..1220aea6e 100644 --- a/packages/markdown/src/utils/userAgent.ts +++ b/packages/markdown/src/utils/userAgent.ts @@ -1,4 +1,4 @@ -import get from 'lodash/get'; +import get from 'lodash-es/get.js'; const userAgent = get(window, 'navigator.userAgent', ''); const platform = get(window, 'navigator.platform', ''); diff --git a/packages/markdown/tsconfig.json b/packages/markdown/tsconfig.json index 7908b1848..c5eb62a8e 100644 --- a/packages/markdown/tsconfig.json +++ b/packages/markdown/tsconfig.json @@ -2,8 +2,8 @@ "extends": "../../tsconfig.json", "include": ["src", "types"], "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", + "module": "Node16", + "moduleResolution": "Node16", "lib": ["dom", "esnext"], "rootDir": "./src", "baseUrl": "./", diff --git a/packages/multiple-line/.eslintrc.js b/packages/multiple-line/.eslintrc.cjs similarity index 100% rename from packages/multiple-line/.eslintrc.js rename to packages/multiple-line/.eslintrc.cjs diff --git a/packages/multiple-line/jest.config.js b/packages/multiple-line/jest.config.js index 2da53fcff..c0b29bf39 100644 --- a/packages/multiple-line/jest.config.js +++ b/packages/multiple-line/jest.config.js @@ -1,10 +1,8 @@ -/* eslint-disable */ +import baseConfig from '../../baseESMJestConfig.js'; +import packageJSON from './package.json' assert { type: 'json' }; -const baseConfig = require('../../baseJestConfig'); +const packageName = packageJSON.name.split('@contentful/')[1]; -const package = require('./package.json'); -const packageName = package.name.split('@contentful/')[1]; - -module.exports = { +export default { ...baseConfig(packageName), }; diff --git a/packages/multiple-line/package.json b/packages/multiple-line/package.json index e89027c25..88467ce30 100644 --- a/packages/multiple-line/package.json +++ b/packages/multiple-line/package.json @@ -1,17 +1,10 @@ { "name": "@contentful/field-editor-multiple-line", "version": "1.3.4", - "main": "dist/cjs/index.js", + "type": "module", + "main": "dist/esm/index.js", "module": "dist/esm/index.js", "types": "dist/types/index.d.ts", - "exports": { - ".": { - "types": "./dist/types/index.d.ts", - "require": "./dist/cjs/index.js", - "default": "./dist/cjs/index.js" - }, - "./package.json": "./package.json" - }, "files": [ "dist" ], @@ -23,12 +16,10 @@ }, "scripts": { "watch": "yarn concurrently \"yarn:watch:*\"", - "watch:cjs": "yarn build:cjs -w", "watch:esm": "yarn build:esm -w", "watch:types": "yarn build:types --watch", - "build": "yarn build:types && yarn build:cjs && yarn build:esm", + "build": "yarn build:types && yarn build:esm", "build:types": "tsc --outDir dist/types --emitDeclarationOnly", - "build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs", "build:esm": "swc src --config-file ../../.swcrc -d dist/esm", "test": "jest --watch", "test:ci": "jest --ci", @@ -42,7 +33,8 @@ "lodash": "^4.17.15" }, "devDependencies": { - "@contentful/field-editor-test-utils": "^1.4.3" + "@contentful/field-editor-test-utils": "^1.4.3", + "@jest/globals": "29.7.0" }, "peerDependencies": { "react": ">=16.8.0" diff --git a/packages/multiple-line/src/MultipleLineEditor.test.tsx b/packages/multiple-line/src/MultipleLineEditor.test.tsx index 588238777..f345252c8 100644 --- a/packages/multiple-line/src/MultipleLineEditor.test.tsx +++ b/packages/multiple-line/src/MultipleLineEditor.test.tsx @@ -1,10 +1,11 @@ import * as React from 'react'; import { createFakeFieldAPI, createFakeLocalesAPI } from '@contentful/field-editor-test-utils'; +import { jest } from '@jest/globals'; import { cleanup, configure, fireEvent, render, waitFor } from '@testing-library/react'; import '@testing-library/jest-dom/extend-expect'; -import { MultipleLineEditor } from './MultipleLineEditor'; +import { MultipleLineEditor } from './MultipleLineEditor.js'; configure({ testIdAttribute: 'data-test-id', diff --git a/packages/multiple-line/src/MultipleLineEditor.tsx b/packages/multiple-line/src/MultipleLineEditor.tsx index 36702fc37..af89300b2 100644 --- a/packages/multiple-line/src/MultipleLineEditor.tsx +++ b/packages/multiple-line/src/MultipleLineEditor.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; -import { Textarea } from '@contentful/f36-components'; +import { Textarea } from '@contentful/f36-forms'; import { FieldAPI, LocalesAPI, @@ -10,8 +10,7 @@ import { ConstraintsUtils, } from '@contentful/field-editor-shared'; -import * as styles from './styles'; - +import * as styles from './styles.js'; export interface MultipleLineEditorProps { /** diff --git a/packages/multiple-line/src/index.tsx b/packages/multiple-line/src/index.tsx index 3135b9af2..2e0fcd646 100644 --- a/packages/multiple-line/src/index.tsx +++ b/packages/multiple-line/src/index.tsx @@ -1 +1 @@ -export { MultipleLineEditor } from './MultipleLineEditor'; +export { MultipleLineEditor } from './MultipleLineEditor.js'; diff --git a/packages/multiple-line/tsconfig.json b/packages/multiple-line/tsconfig.json index 7908b1848..c5eb62a8e 100644 --- a/packages/multiple-line/tsconfig.json +++ b/packages/multiple-line/tsconfig.json @@ -2,8 +2,8 @@ "extends": "../../tsconfig.json", "include": ["src", "types"], "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", + "module": "Node16", + "moduleResolution": "Node16", "lib": ["dom", "esnext"], "rootDir": "./src", "baseUrl": "./", diff --git a/packages/number/.eslintrc.js b/packages/number/.eslintrc.cjs similarity index 100% rename from packages/number/.eslintrc.js rename to packages/number/.eslintrc.cjs diff --git a/packages/number/jest.config.js b/packages/number/jest.config.js index 2da53fcff..c0b29bf39 100644 --- a/packages/number/jest.config.js +++ b/packages/number/jest.config.js @@ -1,10 +1,8 @@ -/* eslint-disable */ +import baseConfig from '../../baseESMJestConfig.js'; +import packageJSON from './package.json' assert { type: 'json' }; -const baseConfig = require('../../baseJestConfig'); +const packageName = packageJSON.name.split('@contentful/')[1]; -const package = require('./package.json'); -const packageName = package.name.split('@contentful/')[1]; - -module.exports = { +export default { ...baseConfig(packageName), }; diff --git a/packages/number/package.json b/packages/number/package.json index 680c1823b..ca323212d 100644 --- a/packages/number/package.json +++ b/packages/number/package.json @@ -1,17 +1,9 @@ { "name": "@contentful/field-editor-number", "version": "1.3.4", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "type": "module", + "main": "dist/esm/index.js", "types": "dist/types/index.d.ts", - "exports": { - ".": { - "types": "./dist/types/index.d.ts", - "require": "./dist/cjs/index.js", - "default": "./dist/cjs/index.js" - }, - "./package.json": "./package.json" - }, "files": [ "dist" ], @@ -23,12 +15,10 @@ }, "scripts": { "watch": "yarn concurrently \"yarn:watch:*\"", - "watch:cjs": "yarn build:cjs -w", "watch:esm": "yarn build:esm -w", "watch:types": "yarn build:types --watch", - "build": "yarn build:types && yarn build:cjs && yarn build:esm", + "build": "yarn build:types && yarn build:esm", "build:types": "tsc --outDir dist/types --emitDeclarationOnly", - "build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs", "build:esm": "swc src --config-file ../../.swcrc -d dist/esm", "test": "jest --watch", "test:ci": "jest --ci", @@ -42,6 +32,7 @@ }, "devDependencies": { "@contentful/field-editor-test-utils": "^1.4.3", + "@jest/globals": "29.7.0", "@testing-library/jest-dom": "^5.12.0", "@testing-library/react": "^11.2.6", "@testing-library/user-event": "^13.1.9" diff --git a/packages/number/src/NumberEditor.spec.tsx b/packages/number/src/NumberEditor.spec.tsx index 098f4514d..69ab3c547 100644 --- a/packages/number/src/NumberEditor.spec.tsx +++ b/packages/number/src/NumberEditor.spec.tsx @@ -1,11 +1,13 @@ import * as React from 'react'; import { createFakeFieldAPI } from '@contentful/field-editor-test-utils'; +import { jest } from '@jest/globals'; import '@testing-library/jest-dom/extend-expect'; import { cleanup, configure, render, screen, waitFor } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; +import { clear as userEventClear } from '@testing-library/user-event/dist/clear.js'; +import { type as userEventType } from '@testing-library/user-event/dist/type/index.js'; -import { NumberEditor } from './NumberEditor'; +import { NumberEditor } from './NumberEditor.js'; configure({ testIdAttribute: 'data-test-id', @@ -46,7 +48,7 @@ describe('NumberEditor', () => { render(); const $input = screen.getByTestId('number-editor-input'); - userEvent.type($input, '22'); + userEventType($input, '22'); await waitFor(() => { expect(field.setValue).toHaveBeenCalledWith(22); }); @@ -57,7 +59,7 @@ describe('NumberEditor', () => { render(); const $input = screen.getByTestId('number-editor-input'); - userEvent.type($input, '0'); + userEventType($input, '0'); await waitFor(() => { expect(field.setValue).toHaveBeenCalledWith(0); }); @@ -71,23 +73,23 @@ describe('NumberEditor', () => { // Testing that `4`, `44`, and `44.2` gets set as valid values while the // invalid state `44.` does not get set. - userEvent.type($input, '4'); + userEventType($input, '4'); await waitFor(() => { expect(field.setValue).toHaveBeenCalledWith(4); }); - userEvent.type($input, '4'); + userEventType($input, '4'); await waitFor(() => { expect(field.setValue).toHaveBeenCalledWith(44); }); - userEvent.type($input, '.'); + userEventType($input, '.'); await waitFor(() => { // `44.` does not get set expect(field.setValue).toHaveBeenLastCalledWith(44); }); - userEvent.type($input, '2'); + userEventType($input, '2'); await waitFor(() => { expect(field.setValue).toHaveBeenCalledWith(44.2); }); @@ -100,7 +102,7 @@ describe('NumberEditor', () => { render(); const $input = screen.getByTestId('number-editor-input'); - userEvent.type($input, 'invalid'); + userEventType($input, 'invalid'); expect(field.setValue).not.toHaveBeenCalled(); }); @@ -111,7 +113,7 @@ describe('NumberEditor', () => { expect($input).toHaveValue('42'); - userEvent.clear($input); + userEventClear($input); await waitFor(() => { expect($input).toHaveValue(''); expect(field.setValue).not.toHaveBeenCalled(); diff --git a/packages/number/src/NumberEditor.tsx b/packages/number/src/NumberEditor.tsx index 34db43bc0..3524a1054 100644 --- a/packages/number/src/NumberEditor.tsx +++ b/packages/number/src/NumberEditor.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; -import { TextInput } from '@contentful/f36-components'; +import { TextInput } from '@contentful/f36-forms'; import { ArrowUpTrimmedIcon, ArrowDownTrimmedIcon } from '@contentful/f36-icons'; import { FieldAPI, @@ -8,9 +8,9 @@ import { FieldConnectorChildProps, } from '@contentful/field-editor-shared'; -import { styles } from './NumberEditor.styles'; -import { isNumberInputValueValid, parseNumber } from './parseNumber'; -import { getRangeFromField, valueToString, countDecimals } from './utils'; +import { styles } from './NumberEditor.styles.js'; +import { isNumberInputValueValid, parseNumber } from './parseNumber.js'; +import { getRangeFromField, valueToString, countDecimals } from './utils.js'; export interface NumberEditorProps { /** @@ -155,14 +155,16 @@ function InnerNumberEditor({ tabIndex={-1} className={styles.control} onClick={() => changeValueByStep(StepChangeType.Increment)} - onPointerDown={handleControlPointerDown}> + onPointerDown={handleControlPointerDown} + > diff --git a/packages/number/src/index.tsx b/packages/number/src/index.tsx index 7a36f6497..6b4c292e3 100644 --- a/packages/number/src/index.tsx +++ b/packages/number/src/index.tsx @@ -1 +1 @@ -export { NumberEditor } from './NumberEditor'; +export { NumberEditor } from './NumberEditor.js'; diff --git a/packages/number/src/parseNumber.spec.ts b/packages/number/src/parseNumber.spec.ts index 789ff06c0..58f48528c 100644 --- a/packages/number/src/parseNumber.spec.ts +++ b/packages/number/src/parseNumber.spec.ts @@ -1,4 +1,4 @@ -import { parseNumber, isNumberInputValueValid } from './parseNumber'; +import { parseNumber, isNumberInputValueValid } from './parseNumber.js'; describe('parseNumber', () => { it('should parse values properly when type is Integer', () => { diff --git a/packages/number/tsconfig.json b/packages/number/tsconfig.json index 7908b1848..c5eb62a8e 100644 --- a/packages/number/tsconfig.json +++ b/packages/number/tsconfig.json @@ -2,8 +2,8 @@ "extends": "../../tsconfig.json", "include": ["src", "types"], "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", + "module": "Node16", + "moduleResolution": "Node16", "lib": ["dom", "esnext"], "rootDir": "./src", "baseUrl": "./", diff --git a/packages/radio/.eslintrc.js b/packages/radio/.eslintrc.cjs similarity index 100% rename from packages/radio/.eslintrc.js rename to packages/radio/.eslintrc.cjs diff --git a/packages/radio/jest.config.js b/packages/radio/jest.config.js index 2da53fcff..c0b29bf39 100644 --- a/packages/radio/jest.config.js +++ b/packages/radio/jest.config.js @@ -1,10 +1,8 @@ -/* eslint-disable */ +import baseConfig from '../../baseESMJestConfig.js'; +import packageJSON from './package.json' assert { type: 'json' }; -const baseConfig = require('../../baseJestConfig'); +const packageName = packageJSON.name.split('@contentful/')[1]; -const package = require('./package.json'); -const packageName = package.name.split('@contentful/')[1]; - -module.exports = { +export default { ...baseConfig(packageName), }; diff --git a/packages/radio/package.json b/packages/radio/package.json index 09d5bd857..b0f09f364 100644 --- a/packages/radio/package.json +++ b/packages/radio/package.json @@ -1,17 +1,9 @@ { "name": "@contentful/field-editor-radio", "version": "1.4.2", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "type": "module", + "main": "dist/esm/index.js", "types": "dist/types/index.d.ts", - "exports": { - ".": { - "types": "./dist/types/index.d.ts", - "require": "./dist/cjs/index.js", - "default": "./dist/cjs/index.js" - }, - "./package.json": "./package.json" - }, "files": [ "dist" ], @@ -23,12 +15,10 @@ }, "scripts": { "watch": "yarn concurrently \"yarn:watch:*\"", - "watch:cjs": "yarn build:cjs -w", "watch:esm": "yarn build:esm -w", "watch:types": "yarn build:types --watch", - "build": "yarn build:types && yarn build:cjs && yarn build:esm", + "build": "yarn build:types && yarn build:esm", "build:types": "tsc --outDir dist/types --emitDeclarationOnly", - "build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs", "build:esm": "swc src --config-file ../../.swcrc -d dist/esm", "test": "jest --watch", "test:ci": "jest --ci", @@ -45,6 +35,7 @@ }, "devDependencies": { "@contentful/field-editor-test-utils": "^1.4.3", + "@jest/globals": "29.7.0", "contentful-management": "^10.0.0" }, "peerDependencies": { diff --git a/packages/radio/src/RadioEditor.spec.tsx b/packages/radio/src/RadioEditor.spec.tsx index 4c4607666..549d2e075 100644 --- a/packages/radio/src/RadioEditor.spec.tsx +++ b/packages/radio/src/RadioEditor.spec.tsx @@ -1,10 +1,11 @@ import * as React from 'react'; import { createFakeFieldAPI, createFakeLocalesAPI } from '@contentful/field-editor-test-utils'; +import { jest } from '@jest/globals'; import '@testing-library/jest-dom/extend-expect'; import { cleanup, configure, fireEvent, render } from '@testing-library/react'; -import { RadioEditor } from './RadioEditor'; +import { RadioEditor } from './RadioEditor.js'; configure({ testIdAttribute: 'data-test-id', diff --git a/packages/radio/src/RadioEditor.tsx b/packages/radio/src/RadioEditor.tsx index 22d6b8663..210fb34e1 100644 --- a/packages/radio/src/RadioEditor.tsx +++ b/packages/radio/src/RadioEditor.tsx @@ -1,6 +1,8 @@ import * as React from 'react'; -import { TextLink, Flex, Radio, Form } from '@contentful/f36-components'; +import { Flex } from '@contentful/f36-core'; +import { Radio, Form } from '@contentful/f36-forms'; +import { TextLink } from '@contentful/f36-text-link'; import { getOptions, parseValue } from '@contentful/field-editor-dropdown'; import { FieldAPI, @@ -10,7 +12,7 @@ import { } from '@contentful/field-editor-shared'; import { cx } from 'emotion'; -import * as styles from './styles'; +import * as styles from './styles.js'; export interface RadioEditorProps { /** diff --git a/packages/radio/src/index.tsx b/packages/radio/src/index.tsx index e25a132cf..cb752d727 100644 --- a/packages/radio/src/index.tsx +++ b/packages/radio/src/index.tsx @@ -1 +1 @@ -export { RadioEditor } from './RadioEditor'; +export { RadioEditor } from './RadioEditor.js'; diff --git a/packages/radio/tsconfig.json b/packages/radio/tsconfig.json index 7908b1848..c5eb62a8e 100644 --- a/packages/radio/tsconfig.json +++ b/packages/radio/tsconfig.json @@ -2,8 +2,8 @@ "extends": "../../tsconfig.json", "include": ["src", "types"], "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", + "module": "Node16", + "moduleResolution": "Node16", "lib": ["dom", "esnext"], "rootDir": "./src", "baseUrl": "./", diff --git a/packages/rating/.eslintrc.js b/packages/rating/.eslintrc.cjs similarity index 100% rename from packages/rating/.eslintrc.js rename to packages/rating/.eslintrc.cjs diff --git a/packages/rating/jest.config.js b/packages/rating/jest.config.js index 2da53fcff..c0b29bf39 100644 --- a/packages/rating/jest.config.js +++ b/packages/rating/jest.config.js @@ -1,10 +1,8 @@ -/* eslint-disable */ +import baseConfig from '../../baseESMJestConfig.js'; +import packageJSON from './package.json' assert { type: 'json' }; -const baseConfig = require('../../baseJestConfig'); +const packageName = packageJSON.name.split('@contentful/')[1]; -const package = require('./package.json'); -const packageName = package.name.split('@contentful/')[1]; - -module.exports = { +export default { ...baseConfig(packageName), }; diff --git a/packages/rating/package.json b/packages/rating/package.json index ec2d67c6e..f0ca61082 100644 --- a/packages/rating/package.json +++ b/packages/rating/package.json @@ -1,17 +1,9 @@ { "name": "@contentful/field-editor-rating", "version": "1.4.2", - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "type": "module", + "main": "dist/esm/index.js", "types": "dist/types/index.d.ts", - "exports": { - ".": { - "types": "./dist/types/index.d.ts", - "require": "./dist/cjs/index.js", - "default": "./dist/cjs/index.js" - }, - "./package.json": "./package.json" - }, "files": [ "dist" ], @@ -23,12 +15,10 @@ }, "scripts": { "watch": "yarn concurrently \"yarn:watch:*\"", - "watch:cjs": "yarn build:cjs -w", "watch:esm": "yarn build:esm -w", "watch:types": "yarn build:types --watch", - "build": "yarn build:types && yarn build:cjs && yarn build:esm", + "build": "yarn build:types && yarn build:esm", "build:types": "tsc --outDir dist/types --emitDeclarationOnly", - "build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs", "build:esm": "swc src --config-file ../../.swcrc -d dist/esm", "test": "jest --watch", "test:ci": "jest --ci", @@ -42,7 +32,8 @@ "lodash": "^4.17.15" }, "devDependencies": { - "@contentful/field-editor-test-utils": "^1.4.3" + "@contentful/field-editor-test-utils": "^1.4.3", + "@jest/globals": "29.7.0" }, "peerDependencies": { "react": ">=16.8.0" diff --git a/packages/rating/src/RatingEditor.spec.tsx b/packages/rating/src/RatingEditor.spec.tsx index 04bacfabb..1f13f3c09 100644 --- a/packages/rating/src/RatingEditor.spec.tsx +++ b/packages/rating/src/RatingEditor.spec.tsx @@ -1,10 +1,11 @@ import * as React from 'react'; import { createFakeFieldAPI } from '@contentful/field-editor-test-utils'; +import { jest } from '@jest/globals'; import '@testing-library/jest-dom/extend-expect'; import { cleanup, configure, fireEvent, render } from '@testing-library/react'; -import { RatingEditor } from './RatingEditor'; +import { RatingEditor } from './RatingEditor.js'; configure({ testIdAttribute: 'data-test-id', diff --git a/packages/rating/src/RatingEditor.tsx b/packages/rating/src/RatingEditor.tsx index b8e5aadc3..dca2bdd22 100644 --- a/packages/rating/src/RatingEditor.tsx +++ b/packages/rating/src/RatingEditor.tsx @@ -1,10 +1,11 @@ import * as React from 'react'; -import { TextLink, Flex } from '@contentful/f36-components'; +import { Flex } from '@contentful/f36-core'; +import { TextLink } from '@contentful/f36-text-link'; import { FieldAPI, ParametersAPI, FieldConnector } from '@contentful/field-editor-shared'; -import get from 'lodash/get'; +import get from 'lodash-es/get.js'; -import { RatingRibbon } from './RatingRibbon'; +import { RatingRibbon } from './RatingRibbon.js'; export interface RatingEditorProps { /** diff --git a/packages/rating/src/RatingRibbon.tsx b/packages/rating/src/RatingRibbon.tsx index e19908a7a..94816fc9d 100644 --- a/packages/rating/src/RatingRibbon.tsx +++ b/packages/rating/src/RatingRibbon.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; - -import { IconButton } from '@contentful/f36-components'; +import { IconButton } from '@contentful/f36-button'; import { StarIcon } from '@contentful/f36-icons'; import { css } from 'emotion'; diff --git a/packages/rating/src/index.tsx b/packages/rating/src/index.tsx index c2980492e..9156a5f5a 100644 --- a/packages/rating/src/index.tsx +++ b/packages/rating/src/index.tsx @@ -1 +1 @@ -export { RatingEditor } from './RatingEditor'; +export { RatingEditor } from './RatingEditor.js'; diff --git a/packages/rating/tsconfig.json b/packages/rating/tsconfig.json index 7908b1848..c5eb62a8e 100644 --- a/packages/rating/tsconfig.json +++ b/packages/rating/tsconfig.json @@ -2,8 +2,8 @@ "extends": "../../tsconfig.json", "include": ["src", "types"], "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", + "module": "Node16", + "moduleResolution": "Node16", "lib": ["dom", "esnext"], "rootDir": "./src", "baseUrl": "./", diff --git a/yarn.lock b/yarn.lock index 62605a690..4a5b0ec3d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4246,6 +4246,16 @@ "@types/node" "*" jest-mock "^29.5.0" +"@jest/environment@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.7.0.tgz#24d61f54ff1f786f3cd4073b4b94416383baf2a7" + integrity sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw== + dependencies: + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + jest-mock "^29.7.0" + "@jest/expect-utils@^29.5.0": version "29.5.0" resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.5.0.tgz#f74fad6b6e20f924582dc8ecbf2cb800fe43a036" @@ -4253,6 +4263,13 @@ dependencies: jest-get-type "^29.4.3" +"@jest/expect-utils@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.7.0.tgz#023efe5d26a8a70f21677d0a1afc0f0a44e3a1c6" + integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== + dependencies: + jest-get-type "^29.6.3" + "@jest/expect@^29.5.0": version "29.5.0" resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.5.0.tgz#80952f5316b23c483fbca4363ce822af79c38fba" @@ -4261,6 +4278,14 @@ expect "^29.5.0" jest-snapshot "^29.5.0" +"@jest/expect@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.7.0.tgz#76a3edb0cb753b70dfbfe23283510d3d45432bf2" + integrity sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ== + dependencies: + expect "^29.7.0" + jest-snapshot "^29.7.0" + "@jest/fake-timers@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-26.6.2.tgz#459c329bcf70cee4af4d7e3f3e67848123535aad" @@ -4297,6 +4322,28 @@ jest-mock "^29.5.0" jest-util "^29.5.0" +"@jest/fake-timers@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.7.0.tgz#fd91bf1fffb16d7d0d24a426ab1a47a49881a565" + integrity sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ== + dependencies: + "@jest/types" "^29.6.3" + "@sinonjs/fake-timers" "^10.0.2" + "@types/node" "*" + jest-message-util "^29.7.0" + jest-mock "^29.7.0" + jest-util "^29.7.0" + +"@jest/globals@29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d" + integrity sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/expect" "^29.7.0" + "@jest/types" "^29.6.3" + jest-mock "^29.7.0" + "@jest/globals@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-26.6.2.tgz#5b613b78a1aa2655ae908eba638cc96a20df720a" @@ -4432,6 +4479,13 @@ dependencies: "@sinclair/typebox" "^0.25.16" +"@jest/schemas@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" + integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== + dependencies: + "@sinclair/typebox" "^0.27.8" + "@jest/source-map@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-26.6.2.tgz#29af5e1e2e324cafccc936f218309f54ab69d535" @@ -4593,6 +4647,27 @@ slash "^3.0.0" write-file-atomic "^4.0.2" +"@jest/transform@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.7.0.tgz#df2dd9c346c7d7768b8a06639994640c642e284c" + integrity sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw== + dependencies: + "@babel/core" "^7.11.6" + "@jest/types" "^29.6.3" + "@jridgewell/trace-mapping" "^0.3.18" + babel-plugin-istanbul "^6.1.1" + chalk "^4.0.0" + convert-source-map "^2.0.0" + fast-json-stable-stringify "^2.1.0" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + jest-regex-util "^29.6.3" + jest-util "^29.7.0" + micromatch "^4.0.4" + pirates "^4.0.4" + slash "^3.0.0" + write-file-atomic "^4.0.2" + "@jest/types@^26.6.0", "@jest/types@^26.6.2": version "26.6.2" resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e" @@ -4639,6 +4714,18 @@ "@types/yargs" "^17.0.8" chalk "^4.0.0" +"@jest/types@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" + integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== + dependencies: + "@jest/schemas" "^29.6.3" + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^3.0.0" + "@types/node" "*" + "@types/yargs" "^17.0.8" + chalk "^4.0.0" + "@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": version "0.3.3" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" @@ -4653,6 +4740,11 @@ resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== +"@jridgewell/resolve-uri@^3.1.0": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" + integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== + "@jridgewell/set-array@^1.0.1": version "1.1.2" resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" @@ -4671,7 +4763,7 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== -"@jridgewell/sourcemap-codec@^1.4.10": +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": version "1.4.15" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== @@ -4684,6 +4776,14 @@ "@jridgewell/resolve-uri" "3.1.0" "@jridgewell/sourcemap-codec" "1.4.14" +"@jridgewell/trace-mapping@^0.3.18": + version "0.3.20" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz#72e45707cf240fa6b081d0366f8265b0cd10197f" + integrity sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + "@juggle/resize-observer@^3.3.1", "@juggle/resize-observer@^3.4.0": version "3.4.0" resolved "https://registry.yarnpkg.com/@juggle/resize-observer/-/resize-observer-3.4.0.tgz#08d6c5e20cf7e4cc02fd181c4b0c225cd31dbb60" @@ -5742,6 +5842,11 @@ resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.24.tgz#8c7688559979f7079aacaf31aa881c3aa410b718" integrity sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ== +"@sinclair/typebox@^0.27.8": + version "0.27.8" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" + integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== + "@sindresorhus/is@^0.14.0": version "0.14.0" resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" @@ -7700,6 +7805,18 @@ dependencies: "@types/node" "*" +"@types/lodash-es@4.17.9": + version "4.17.9" + resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.9.tgz#49dbe5112e23c54f2b387d860b7d03028ce170c2" + integrity sha512-ZTcmhiI3NNU7dEvWLZJkzG6ao49zOIjEgIE0RgV7wbPxU0f2xT3VSAHw2gmst8swH6V0YkLRGp4qPlX/6I90MQ== + dependencies: + "@types/lodash" "*" + +"@types/lodash@*": + version "4.14.200" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.200.tgz#435b6035c7eba9cdf1e039af8212c9e9281e7149" + integrity sha512-YI/M/4HRImtNf3pJgbF+W6FrXovqj+T+/HpENLTooK9PnkacBsDpeP3IpHab40CClUfhNmdM2WTNP2sa2dni5Q== + "@types/lodash@4.14.168": version "4.14.168" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.168.tgz#fe24632e79b7ade3f132891afff86caa5e5ce008" @@ -7854,10 +7971,10 @@ dependencies: "@types/react" "*" -"@types/react-codemirror@1.0.3": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@types/react-codemirror/-/react-codemirror-1.0.3.tgz#5b0e4d5529a6bc934e992c49f3d1fa77daacc59b" - integrity sha512-EAyys2Wpys7bJatgnfpXXs4Gi1Vktj23mNngG4Ex2Q0W6eVgfkP4GP7qHyDVU2wbW3T0K7Jqatf2dCob25ptMw== +"@types/react-codemirror@1.0.10": + version "1.0.10" + resolved "https://registry.yarnpkg.com/@types/react-codemirror/-/react-codemirror-1.0.10.tgz#980fe0d560a00874edef45e36ab8b1de35ee6df9" + integrity sha512-0QfiTtSnGHuiyfd3NBPOqJGaeBIntl975In/Iv5FLwvVpcheEFBb/QZSPvR0MGb2TFJYuHa5tJrRfrBKxk+dGg== dependencies: "@types/codemirror" "*" "@types/react" "*" @@ -8641,10 +8758,10 @@ immer "^9.0.6" react-tracked "^1.7.9" -"@uiw/codemirror-extensions-basic-setup@4.20.2": - version "4.20.2" - resolved "https://registry.yarnpkg.com/@uiw/codemirror-extensions-basic-setup/-/codemirror-extensions-basic-setup-4.20.2.tgz#25c098c9984403955498d996435c43941507a039" - integrity sha512-8oF7ICSEoJVjn9MNKLsY5BaxGsFS/Qh8AMHa/0hZP1fExeI+LKhaaSfHbdRk8RpYE5Ffjtx+tBQfh22YBiv5dQ== +"@uiw/codemirror-extensions-basic-setup@4.21.20": + version "4.21.20" + resolved "https://registry.yarnpkg.com/@uiw/codemirror-extensions-basic-setup/-/codemirror-extensions-basic-setup-4.21.20.tgz#9dbfab401a3168312c3f1d908b0f9b280410c206" + integrity sha512-Wyi9q4uw0xGYd/tJ6bULG7tkCLqcUsQT0AQBfCDtnkV3LdiLU0LceTrzJoHJyIKSHsKDJxFQxa1qg3QLt4gIUA== dependencies: "@codemirror/autocomplete" "^6.0.0" "@codemirror/commands" "^6.0.0" @@ -8654,16 +8771,16 @@ "@codemirror/state" "^6.0.0" "@codemirror/view" "^6.0.0" -"@uiw/react-codemirror@^4.11.4": - version "4.20.2" - resolved "https://registry.yarnpkg.com/@uiw/react-codemirror/-/react-codemirror-4.20.2.tgz#e429821b0c5fb572e50ab38329086a79cd7f908f" - integrity sha512-Rf6i9HgtNnYAVRBb1gfWlhiiOBrEPuIfHLn87cV9XPpjP+YtqZoP6VMMlMq4XFTbZ/E1GIxnSUgJMQToTth0iw== +"@uiw/react-codemirror@^4.21.20": + version "4.21.20" + resolved "https://registry.yarnpkg.com/@uiw/react-codemirror/-/react-codemirror-4.21.20.tgz#bbfb57676c9939d880de6c7223c2ed7410271145" + integrity sha512-PdyewPvNXnvT3JHj888yjpbWsAGw5qlxW6w1sMdsqJ0R6vPV++ob1iZXCGrM1FVpbqPK0DNfpXvjzp2gIr3lYw== dependencies: "@babel/runtime" "^7.18.6" "@codemirror/commands" "^6.1.0" "@codemirror/state" "^6.1.1" "@codemirror/theme-one-dark" "^6.0.0" - "@uiw/codemirror-extensions-basic-setup" "4.20.2" + "@uiw/codemirror-extensions-basic-setup" "4.21.20" codemirror "^6.0.0" "@ungap/promise-all-settled@1.1.2": @@ -13288,6 +13405,11 @@ diff-sequences@^29.4.3: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.4.3.tgz#9314bc1fabe09267ffeca9cbafc457d8499a13f2" integrity sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA== +diff-sequences@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" + integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== + diff@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" @@ -14692,6 +14814,17 @@ expect@^29.0.0, expect@^29.5.0: jest-message-util "^29.5.0" jest-util "^29.5.0" +expect@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" + integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== + dependencies: + "@jest/expect-utils" "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + express@^4.17.1, express@^4.17.3: version "4.18.2" resolved "https://registry.yarnpkg.com/express/-/express-4.18.2.tgz#3fabe08296e930c796c19e3c516979386ba9fd59" @@ -18014,6 +18147,16 @@ jest-diff@^29.5.0: jest-get-type "^29.4.3" pretty-format "^29.5.0" +jest-diff@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" + integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== + dependencies: + chalk "^4.0.0" + diff-sequences "^29.6.3" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + jest-docblock@^26.0.0: version "26.0.0" resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-26.0.0.tgz#3e2fa20899fc928cb13bd0ff68bd3711a36889b5" @@ -18159,6 +18302,11 @@ jest-get-type@^29.4.3: resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.4.3.tgz#1ab7a5207c995161100b5187159ca82dd48b3dd5" integrity sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg== +jest-get-type@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" + integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== + jest-haste-map@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-26.6.2.tgz#dd7e60fe7dc0e9f911a23d79c5ff7fb5c2cafeaa" @@ -18219,6 +18367,25 @@ jest-haste-map@^29.5.0: optionalDependencies: fsevents "^2.3.2" +jest-haste-map@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.7.0.tgz#3c2396524482f5a0506376e6c858c3bbcc17b104" + integrity sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA== + dependencies: + "@jest/types" "^29.6.3" + "@types/graceful-fs" "^4.1.3" + "@types/node" "*" + anymatch "^3.0.3" + fb-watchman "^2.0.0" + graceful-fs "^4.2.9" + jest-regex-util "^29.6.3" + jest-util "^29.7.0" + jest-worker "^29.7.0" + micromatch "^4.0.4" + walker "^1.0.8" + optionalDependencies: + fsevents "^2.3.2" + jest-jasmine2@^26.6.3: version "26.6.3" resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-26.6.3.tgz#adc3cf915deacb5212c93b9f3547cd12958f2edd" @@ -18330,6 +18497,16 @@ jest-matcher-utils@^29.5.0: jest-get-type "^29.4.3" pretty-format "^29.5.0" +jest-matcher-utils@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" + integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== + dependencies: + chalk "^4.0.0" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + jest-message-util@^26.6.0, jest-message-util@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-26.6.2.tgz#58173744ad6fc0506b5d21150b9be56ef001ca07" @@ -18390,6 +18567,21 @@ jest-message-util@^29.5.0: slash "^3.0.0" stack-utils "^2.0.3" +jest-message-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" + integrity sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w== + dependencies: + "@babel/code-frame" "^7.12.13" + "@jest/types" "^29.6.3" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.9" + micromatch "^4.0.4" + pretty-format "^29.7.0" + slash "^3.0.0" + stack-utils "^2.0.3" + jest-mock@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-26.6.2.tgz#d6cb712b041ed47fe0d9b6fc3474bc6543feb302" @@ -18415,6 +18607,15 @@ jest-mock@^29.5.0: "@types/node" "*" jest-util "^29.5.0" +jest-mock@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.7.0.tgz#4e836cf60e99c6fcfabe9f99d017f3fdd50a6347" + integrity sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + jest-util "^29.7.0" + jest-pnp-resolver@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" @@ -18440,6 +18641,11 @@ jest-regex-util@^29.4.3: resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.4.3.tgz#a42616141e0cae052cfa32c169945d00c0aa0bb8" integrity sha512-O4FglZaMmWXbGHSQInfXewIsd1LMn9p3ZXB/6r4FOkyhX2/iP/soMG98jGvk/A3HAN78+5VWcBGO0BJAPRh4kg== +jest-regex-util@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.6.3.tgz#4a556d9c776af68e1c5f48194f4d0327d24e8a52" + integrity sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg== + jest-resolve-dependencies@^26.6.3: version "26.6.3" resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-26.6.3.tgz#6680859ee5d22ee5dcd961fe4871f59f4c784fb6" @@ -18789,6 +18995,32 @@ jest-snapshot@^29.5.0: pretty-format "^29.5.0" semver "^7.3.5" +jest-snapshot@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.7.0.tgz#c2c574c3f51865da1bb329036778a69bf88a6be5" + integrity sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw== + dependencies: + "@babel/core" "^7.11.6" + "@babel/generator" "^7.7.2" + "@babel/plugin-syntax-jsx" "^7.7.2" + "@babel/plugin-syntax-typescript" "^7.7.2" + "@babel/types" "^7.3.3" + "@jest/expect-utils" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + babel-preset-current-node-syntax "^1.0.0" + chalk "^4.0.0" + expect "^29.7.0" + graceful-fs "^4.2.9" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + natural-compare "^1.4.0" + pretty-format "^29.7.0" + semver "^7.5.3" + jest-util@^26.6.0, jest-util@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1" @@ -18837,6 +19069,18 @@ jest-util@^29.5.0: graceful-fs "^4.2.9" picomatch "^2.2.3" +jest-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" + integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + ci-info "^3.2.0" + graceful-fs "^4.2.9" + picomatch "^2.2.3" + jest-validate@^26.6.2: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-26.6.2.tgz#23d380971587150467342911c3d7b4ac57ab20ec" @@ -18998,6 +19242,16 @@ jest-worker@^29.5.0: merge-stream "^2.0.0" supports-color "^8.0.0" +jest-worker@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" + integrity sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw== + dependencies: + "@types/node" "*" + jest-util "^29.7.0" + merge-stream "^2.0.0" + supports-color "^8.0.0" + jest@26.6.0: version "26.6.0" resolved "https://registry.yarnpkg.com/jest/-/jest-26.6.0.tgz#546b25a1d8c888569dbbe93cae131748086a4a25" @@ -19799,7 +20053,7 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" -lodash-es@^4.17.15: +lodash-es@4.17.21, lodash-es@^4.17.15: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== @@ -23997,6 +24251,15 @@ pretty-format@^29.0.0, pretty-format@^29.5.0: ansi-styles "^5.0.0" react-is "^18.0.0" +pretty-format@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" + integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== + dependencies: + "@jest/schemas" "^29.6.3" + ansi-styles "^5.0.0" + react-is "^18.0.0" + pretty-hrtime@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1" @@ -26330,6 +26593,13 @@ semver@^7.0.0, semver@^7.1.1, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4, semve dependencies: lru-cache "^6.0.0" +semver@^7.5.3: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + dependencies: + lru-cache "^6.0.0" + semver@~7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e"