@remoteoss/json-schema-form 1.0.0-beta.2 → 1.0.0-dev.20250124133204

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 22.13.1
@@ -0,0 +1,51 @@
1
+ {
2
+ // Disable the default formatter, use eslint instead
3
+ "prettier.enable": false,
4
+ "editor.formatOnSave": false,
5
+
6
+ // Auto fix
7
+ "editor.codeActionsOnSave": {
8
+ "source.fixAll.eslint": "explicit",
9
+ "source.organizeImports": "never"
10
+ },
11
+
12
+ // Silent the stylistic rules in you IDE, but still auto fix them
13
+ "eslint.rules.customizations": [
14
+ { "rule": "style/*", "severity": "off", "fixable": true },
15
+ { "rule": "format/*", "severity": "off", "fixable": true },
16
+ { "rule": "*-indent", "severity": "off", "fixable": true },
17
+ { "rule": "*-spacing", "severity": "off", "fixable": true },
18
+ { "rule": "*-spaces", "severity": "off", "fixable": true },
19
+ { "rule": "*-order", "severity": "off", "fixable": true },
20
+ { "rule": "*-dangle", "severity": "off", "fixable": true },
21
+ { "rule": "*-newline", "severity": "off", "fixable": true },
22
+ { "rule": "*quotes", "severity": "off", "fixable": true },
23
+ { "rule": "*semi", "severity": "off", "fixable": true }
24
+ ],
25
+
26
+ // Enable eslint for all supported languages
27
+ "eslint.validate": [
28
+ "javascript",
29
+ "javascriptreact",
30
+ "typescript",
31
+ "typescriptreact",
32
+ "vue",
33
+ "html",
34
+ "markdown",
35
+ "json",
36
+ "json5",
37
+ "jsonc",
38
+ "yaml",
39
+ "toml",
40
+ "xml",
41
+ "gql",
42
+ "graphql",
43
+ "astro",
44
+ "svelte",
45
+ "css",
46
+ "less",
47
+ "scss",
48
+ "pcss",
49
+ "postcss"
50
+ ]
51
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @type {import('@babel/core').TransformOptions}
3
+ */
4
+ const options = {
5
+ presets: [
6
+ ['@babel/preset-env', { targets: { node: 'current' } }],
7
+ // Type checking is already done in our build,
8
+ // so we can use a lightweight preset.
9
+ // - https://jestjs.io/docs/getting-started#using-typescript
10
+ '@babel/preset-typescript',
11
+ ],
12
+ }
13
+
14
+ export default options
@@ -0,0 +1,3 @@
1
+ import antfu from '@antfu/eslint-config'
2
+
3
+ export default antfu({})
@@ -0,0 +1,52 @@
1
+ /**
2
+ * This next version of JSON Schema Form ("V2")
3
+ * must be tested against 2 sets ("root") of tests.
4
+ * Note that "rootDir" is the path to this next version.
5
+ *
6
+ * @type {import('jest').Config['roots']}
7
+ */
8
+ const roots = [
9
+ // 1. The existing tests from the previous version ("V1")
10
+ '<rootDir>/../src/tests',
11
+ // 2. The new tests for this version
12
+ '<rootDir>/test',
13
+ ]
14
+
15
+ /**
16
+ * Module aliases to use the same test with different source versions.
17
+ * To learn more, see "roots" above.
18
+ *
19
+ * This is only needed to use V1 tests for V2 source.
20
+ * as V2 tests are used to test V2 source only.
21
+ *
22
+ * @type {import('jest').Config['moduleNameMapper']}
23
+ */
24
+ const moduleNameMapper = {
25
+ // We use kebab-case in V2
26
+ '^@/createHeadlessForm$': '<rootDir>/src/form',
27
+ '^@/utils$': '<rootDir>/src/utils',
28
+ // Avoid catch all aliases such as "^@/(.*)$".
29
+ // Aliases should be added as needed.
30
+ // If there are many, we will have a compat barrel file.
31
+ }
32
+
33
+ /**
34
+ * Some tests are invalid for V2 testing.
35
+ * For example:
36
+ * - Buggy behaviours in V1 that are already fixed (and tested) in V2
37
+ * - Deprecated or removed APIs
38
+ *
39
+ * @type {import('jest').Config['testPathIgnorePatterns']}
40
+ */
41
+ const testPathIgnorePatterns = [
42
+ // Nothing yet
43
+ ]
44
+
45
+ /** @type {import('jest').Config} */
46
+ const config = {
47
+ roots,
48
+ moduleNameMapper,
49
+ testPathIgnorePatterns,
50
+ }
51
+
52
+ export default config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remoteoss/json-schema-form",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-dev.20250124133204",
4
4
  "packageManager": "pnpm@9.15.2",
5
5
  "description": "WIP V2 – Headless UI form powered by JSON Schemas",
6
6
  "author": "Remote.com <engineering@remote.com> (https://remote.com/)",
@@ -16,12 +16,7 @@
16
16
  "json-schema",
17
17
  "form"
18
18
  ],
19
- "main": "dist/index.mjs",
20
- "module": "dist/index.mjs",
21
- "files": [
22
- "README.md",
23
- "dist"
24
- ],
19
+ "main": "index.js",
25
20
  "engines": {
26
21
  "node": ">=18.14.0"
27
22
  },
package/src/form.ts ADDED
@@ -0,0 +1,3 @@
1
+ export function createHeadlessForm(): never {
2
+ throw new Error('Not implemented')
3
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { createHeadlessForm } from './form'
package/src/utils.ts ADDED
@@ -0,0 +1,24 @@
1
+ type DiskSizeUnit = 'Bytes' | 'KB' | 'MB'
2
+
3
+ /**
4
+ * @todo: Remove this.
5
+ *
6
+ * This utility only exists as an example of using V1 tests for V2 source.
7
+ * It should not be tested, or even part of JSON Schema Form.
8
+ */
9
+ export function convertDiskSizeFromTo(
10
+ from: DiskSizeUnit,
11
+ to: DiskSizeUnit,
12
+ ): (value: number) => number {
13
+ const multipliers: Record<DiskSizeUnit, number> = {
14
+ Bytes: 1,
15
+ KB: 1024,
16
+ MB: 1024 * 1024,
17
+ }
18
+
19
+ return (value: number): number => {
20
+ const fromMultiplier = multipliers[from]
21
+ const toMultiplier = multipliers[to]
22
+ return (value * fromMultiplier) / toMultiplier
23
+ }
24
+ }
@@ -0,0 +1,11 @@
1
+ import { describe, expect, it } from '@jest/globals'
2
+ import { createHeadlessForm } from '../src'
3
+
4
+ /**
5
+ * Example test suite for V2
6
+ */
7
+ describe('createHeadlessForm', () => {
8
+ it('should be a function', () => {
9
+ expect(createHeadlessForm).toBeInstanceOf(Function)
10
+ })
11
+ })
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "strict": true,
6
+ "esModuleInterop": true,
7
+ "forceConsistentCasingInFileNames": true,
8
+ "skipLibCheck": true
9
+ },
10
+ "include": [
11
+ "src"
12
+ ]
13
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "clean": true,
3
+ "dts": true,
4
+ "entry": ["src/index.ts"],
5
+ "format": ["esm"],
6
+ "sourcemap": true,
7
+ "minify": true,
8
+ "target": "es2020",
9
+ "outDir": "dist"
10
+ }
package/dist/index.d.mts DELETED
@@ -1,3 +0,0 @@
1
- declare function createHeadlessForm(): never;
2
-
3
- export { createHeadlessForm };
package/dist/index.mjs DELETED
@@ -1,2 +0,0 @@
1
- function e(){throw new Error("Not implemented")}export{e as createHeadlessForm};
2
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/form.ts"],"sourcesContent":["export function createHeadlessForm(): never {\n throw new Error('Not implemented')\n}\n"],"mappings":"AAAO,SAASA,GAA4B,CAC1C,MAAM,IAAI,MAAM,iBAAiB,CACnC","names":["createHeadlessForm"]}