Skip to content
Draft
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .swcrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
}
},
"module": {
"type": "es6"
"type": "es6",
"strict": false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about this

},
"minify": false
}
15 changes: 2 additions & 13 deletions packages/default-field-editors/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
{
"name": "@contentful/default-field-editors",
"version": "1.5.16",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"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"
],
Expand All @@ -23,12 +14,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",
Expand Down
2 changes: 1 addition & 1 deletion packages/default-field-editors/src/Field.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { createFakeFieldAPI, createFakeLocalesAPI } from '@contentful/field-edit
import '@testing-library/jest-dom/extend-expect';
import { cleanup, configure, render } from '@testing-library/react';

import { Field } from './Field';
import { Field } from './Field.js';

configure({
testIdAttribute: 'data-test-id',
Expand Down
4 changes: 2 additions & 2 deletions packages/default-field-editors/src/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import { SlugEditor } from '@contentful/field-editor-slug';
import { TagsEditor } from '@contentful/field-editor-tags';
import { UrlEditor } from '@contentful/field-editor-url';

import { getDefaultWidgetId } from './getDefaultWidgetId';
import type { EditorOptions, WidgetType } from './types';
import { getDefaultWidgetId } from './getDefaultWidgetId.js';
import type { EditorOptions, WidgetType } from './types.js';

type FieldProps = {
sdk: FieldAppSDK;
Expand Down
2 changes: 1 addition & 1 deletion packages/default-field-editors/src/FieldWrapper.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createFakeFieldAPI, createFakeLocalesAPI } from '@contentful/field-edit
import '@testing-library/jest-dom/extend-expect';
import { act, cleanup, configure, render } from '@testing-library/react';

import { FieldWrapper } from './FieldWrapper';
import { FieldWrapper } from './FieldWrapper.js';

configure({
testIdAttribute: 'data-test-id',
Expand Down
2 changes: 1 addition & 1 deletion packages/default-field-editors/src/FieldWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { FieldAppSDK, Entry } from '@contentful/field-editor-shared';
import { ValidationErrors } from '@contentful/field-editor-validation-errors';
import { cx } from 'emotion';

import { styles } from './FieldWrapper.styles';
import { styles } from './FieldWrapper.styles.js';

type FieldWrapperProps = {
name: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/default-field-editors/src/getDefaultWidgetId.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { FieldAppSDK } from '@contentful/field-editor-shared';
import { editorInterfaceDefaults } from 'contentful-management';

import type { WidgetType } from './types';
import type { WidgetType } from './types.js';

export function getDefaultWidgetId(sdk: Pick<FieldAppSDK, 'field' | 'contentType'>): WidgetType {
const field = sdk.field;
Expand Down
8 changes: 4 additions & 4 deletions packages/default-field-editors/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { Field } from './Field';
export { FieldWrapper } from './FieldWrapper';
export type { WidgetType, EditorOptions } from './types';
export { getDefaultWidgetId } from './getDefaultWidgetId';
export { Field } from './Field.js';
export { FieldWrapper } from './FieldWrapper.js';
export type { WidgetType, EditorOptions } from './types.js';
export { getDefaultWidgetId } from './getDefaultWidgetId.js';
5 changes: 2 additions & 3 deletions packages/default-field-editors/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "./",
Expand Down
16 changes: 4 additions & 12 deletions packages/json/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
{
"name": "@contentful/field-editor-json",
"version": "3.3.6",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"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"
],
Expand All @@ -23,10 +14,10 @@
},
"scripts": {
"watch": "yarn concurrently \"yarn:watch:*\"",
"watch:cjs": "yarn build:cjs -w",
"watch:esm": "yarn build:esm -w",
"watch:cjs": "yarn build:cjs -w",
"watch:types": "yarn build:types --watch",
"build": "yarn build:types && yarn build:cjs && yarn build:esm",
"build": "yarn build:types && yarn build:esm && yarn build:cjs",
"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",
Expand All @@ -45,6 +36,7 @@
"lodash": "^4.17.15"
},
"devDependencies": {
"@types/lodash-es": "4.17.9",
"@contentful/field-editor-test-utils": "^1.4.3"
},
"peerDependencies": {
Expand Down
15 changes: 7 additions & 8 deletions packages/json/src/JsonEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
/**
Expand Down Expand Up @@ -168,8 +168,7 @@ export default function JsonEditor(props: JsonEditorProps) {
isInitiallyDisabled={props.isInitiallyDisabled}
isEqualValues={(value1, value2) => {
return deepEqual(value1, value2);
}}
>
}}>
{({ value, disabled, setValue, externalReset }) => {
return (
<ConnectedJsonEditor
Expand Down
5 changes: 2 additions & 3 deletions packages/json/src/JsonEditorField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import tokens from '@contentful/f36-tokens';
import CodeMirror from '@uiw/react-codemirror';
import { css, cx } from 'emotion';

import { SPACE_INDENT_COUNT } from './utils';
import { SPACE_INDENT_COUNT } from './utils.js';

type JsonEditorFieldProps = {
isDisabled: boolean;
Expand Down Expand Up @@ -58,8 +58,7 @@ export function JsonEditorField(props: JsonEditorFieldProps) {
return (
<div
className={cx(styles.root, { disabled: props.isDisabled })}
data-test-id="json-editor-code-mirror"
>
data-test-id="json-editor-code-mirror">
<CodeMirror
value={props.value}
onChange={props.onChange}
Expand Down
6 changes: 5 additions & 1 deletion packages/json/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import JsonEditor from './JsonEditor';
import JsonEditor from './JsonEditor.js';

export { JsonEditor };

export const TestFunction = () => {
console.log('hello');
};
2 changes: 1 addition & 1 deletion packages/json/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JSONObject } from './types';
import { JSONObject } from './types.js';

export const SPACE_INDENT_COUNT = 4;

Expand Down
4 changes: 2 additions & 2 deletions packages/json/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "./",
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7700,6 +7700,18 @@
dependencies:
"@types/node" "*"

"@types/[email protected]":
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/[email protected]":
version "4.14.168"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.168.tgz#fe24632e79b7ade3f132891afff86caa5e5ce008"
Expand Down