Part of #4600. PR: https://github.com/KittyCAD/modeling-app/pull/4826 # Changes to KCL stdlib - `line(point, sketch, tag)` and `lineTo(point, sketch, tag)` are combined into `line(@sketch, end?, endAbsolute?, tag?)` - `close(sketch, tag?)` is now `close(@sketch, tag?)` - `extrude(length, sketch)` is now `extrude(@sketch, length)` Note that if a parameter starts with `@` like `@sketch`, it doesn't have any label when called, so you call it like this: ``` sketch = startSketchAt([0, 0]) line(sketch, end = [3, 3], tag = $hi) ``` Note also that if you're using a `|>` pipeline, you can omit the `@` argument and it will be assumed to be the LHS of the `|>`. So the above could be written as ``` sketch = startSketchAt([0, 0]) |> line(end = [3, 3], tag = $hi) ``` Also changes frontend tests to use KittyCAD/kcl-samples#139 instead of its main The regex find-and-replace I use for migrating code (note these don't work with multi-line expressions) are: ``` line\(([^=]*), %\) line(end = $1) line\((.*), %, (.*)\) line(end = $1, tag = $2) lineTo\((.*), %\) line(endAbsolute = $1) lineTo\((.*), %, (.*)\) line(endAbsolute = $1, tag = $2) extrude\((.*), %\) extrude(length = $1) extrude\(([^=]*), ([a-zA-Z0-9]+)\) extrude($2, length = $1) close\(%, (.*)\) close(tag = $1) ``` # Selected notes from commits before I squash them all * Fix test 'yRelative to horizontal distance' Fixes: - Make a lineTo helper - Fix pathToNode to go through the labeled arg .arg property * Fix test by changing lookups into transformMap Parts of the code assumed that `line` is always a relative call. But actually now it might be absolute, if it's got an `endAbsolute` parameter. So, change whether to look up `line` or `lineTo` and the relevant absolute or relative line types based on that parameter. * Stop asserting on exact source ranges When I changed line to kwargs, all the source ranges we assert on became slightly different. I find these assertions to be very very low value. So I'm removing them. * Fix more tests: getConstraintType calls weren't checking if the 'line' fn was absolute or relative. * Fixed another queryAst test There were 2 problems: - Test was looking for the old style of `line` call to choose an offset for pathToNode - Test assumed that the `tag` param was always the third one, but in a kwarg call, you have to look it up by label * Fix test: traverse was not handling CallExpressionKw * Fix another test, addTagKw addTag helper was not aware of kw args. * Convert close from positional to kwargs If the close() call has 0 args, or a single unlabeled arg, the parser interprets it as a CallExpression (positional) not a CallExpressionKw. But then if a codemod wants to add a tag to it, it tries adding a kwarg called 'tag', which fails because the CallExpression doesn't need kwargs inserted into it. The fix is: change the node from CallExpression to CallExpressionKw, and update getNodeFromPath to take a 'replacement' arg, so we can replace the old node with the new node in the AST. * Fix the last test Test was looking for `lineTo` as a substring of the input KCL program. But there's no more lineTo function, so I changed it to look for line() with an endAbsolute arg, which is the new equivalent. Also changed the getConstraintInfo code to look up the lineTo if using line with endAbsolute. * Fix many bad regex find-replaces I wrote a regex find-and-replace which converted `line` calls from positional to keyword calls. But it was accidentally applied to more places than it should be, for example, angledLine, xLine and yLine calls. Fixes this. * Fixes test 'Basic sketch › code pane closed at start' Problem was, the getNodeFromPath call might not actually find a callExpressionKw, it might find a callExpression. So the `giveSketchFnCallTag` thought it was modifying a kwargs call, but it was actually modifying a positional call. This meant it tried to push a labeled argument in, rather than a normal arg, and a lot of other problems. Fixed by doing runtime typechecking. * Fix: Optional args given with wrong type were silently ignored Optional args don't have to be given. But if the user gives them, they should be the right type. Bug: if the KCL interpreter found an optional arg, which was given, but was the wrong type, it would ignore it and pretend the arg was never given at all. This was confusing for users. Fix: Now if you give an optional arg, but it's the wrong type, KCL will emit a type error just like it would for a mandatory argument. --------- Signed-off-by: Nick Cameron <nrc@ncameron.org> Co-authored-by: Nick Cameron <nrc@ncameron.org> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@kittycad.io> Co-authored-by: Kevin Nadro <kevin@zoo.dev> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
215 lines
10 KiB
JSON
215 lines
10 KiB
JSON
{
|
|
"name": "zoo-modeling-app",
|
|
"version": "0.0.0",
|
|
"private": true,
|
|
"productName": "Zoo Modeling App",
|
|
"author": {
|
|
"name": "Zoo Corporation",
|
|
"email": "info@zoo.dev",
|
|
"url": "https://zoo.dev"
|
|
},
|
|
"description": "Edit CAD visually or with code",
|
|
"main": ".vite/build/main.js",
|
|
"license": "MIT",
|
|
"dependencies": {
|
|
"@codemirror/autocomplete": "^6.17.0",
|
|
"@codemirror/commands": "^6.6.0",
|
|
"@codemirror/language": "^6.10.3",
|
|
"@codemirror/lint": "^6.8.4",
|
|
"@codemirror/search": "^6.5.6",
|
|
"@codemirror/state": "^6.4.1",
|
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
"@csstools/postcss-oklab-function": "^4.0.7",
|
|
"@fortawesome/fontawesome-svg-core": "^6.5.2",
|
|
"@fortawesome/free-brands-svg-icons": "^6.5.2",
|
|
"@fortawesome/free-solid-svg-icons": "^6.4.2",
|
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
"@headlessui/react": "^1.7.19",
|
|
"@headlessui/tailwindcss": "^0.2.0",
|
|
"@kittycad/lib": "2.0.13",
|
|
"@lezer/highlight": "^1.2.1",
|
|
"@lezer/lr": "^1.4.1",
|
|
"@react-hook/resize-observer": "^2.0.1",
|
|
"@replit/codemirror-interact": "^6.3.1",
|
|
"@ts-stack/markdown": "^1.5.0",
|
|
"@tweenjs/tween.js": "^23.1.1",
|
|
"@xstate/inspect": "^0.8.0",
|
|
"@xstate/react": "^4.1.1",
|
|
"bonjour-service": "^1.2.1",
|
|
"chokidar": "^4.0.1",
|
|
"codemirror": "^6.0.1",
|
|
"decamelize": "^6.0.0",
|
|
"diff": "^7.0.0",
|
|
"electron-updater": "6.3.0",
|
|
"fuse.js": "^7.0.0",
|
|
"html2canvas-pro": "^1.5.8",
|
|
"isomorphic-fetch": "^3.0.0",
|
|
"json-rpc-2.0": "^1.6.0",
|
|
"jszip": "^3.10.1",
|
|
"minimist": "^1.2.8",
|
|
"openid-client": "^5.6.5",
|
|
"re-resizable": "^6.9.11",
|
|
"react": "^18.3.1",
|
|
"react-dom": "^18.2.0",
|
|
"react-hot-toast": "^2.4.1",
|
|
"react-hotkeys-hook": "^4.6.1",
|
|
"react-json-view": "^1.21.3",
|
|
"react-modal": "^3.16.3",
|
|
"react-modal-promise": "^1.0.2",
|
|
"react-router-dom": "^6.28.0",
|
|
"sketch-helpers": "^0.0.4",
|
|
"three": "^0.172.0",
|
|
"ua-parser-js": "^1.0.37",
|
|
"uuid": "^11.0.2",
|
|
"vscode-jsonrpc": "^8.2.1",
|
|
"vscode-languageserver-protocol": "^3.17.5",
|
|
"vscode-uri": "^3.0.8",
|
|
"web-vitals": "^3.5.2",
|
|
"xstate": "^5.19.2",
|
|
"yargs": "^17.7.2"
|
|
},
|
|
"scripts": {
|
|
"start": "vite --port=3000 --host=0.0.0.0",
|
|
"start:prod": "vite preview --port=3000",
|
|
"serve": "vite serve --port=3000",
|
|
"build": "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && source \"$HOME/.cargo/env\" && curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -s -- -y && yarn build:wasm && vite build",
|
|
"build:local": "vite build",
|
|
"build:both": "vite build",
|
|
"build:both:local": "yarn build:wasm && vite build",
|
|
"pretest": "yarn remove-importmeta",
|
|
"test:rust": "(cd src/wasm-lib && cargo test --workspace && cargo clippy --workspace --all-targets)",
|
|
"simpleserver": "yarn pretest && http-server ./public --cors -p 3000",
|
|
"simpleserver:ci": "yarn pretest && http-server ./public --cors -p 3000 &",
|
|
"simpleserver:bg": "yarn pretest && http-server ./public --cors -p 3000 &",
|
|
"simpleserver:stop": "kill-port 3000",
|
|
"fmt": "prettier --write ./src *.ts *.json *.js ./e2e ./packages",
|
|
"fmt-check": "prettier --check ./src *.ts *.json *.js ./e2e ./packages",
|
|
"fetch:wasm": "./get-latest-wasm-bundle.sh",
|
|
"fetch:samples": "echo \"Fetching latest KCL samples...\" && curl -o public/kcl-samples-manifest-fallback.json https://raw.githubusercontent.com/KittyCAD/kcl-samples/achalmers/kwargs-line/manifest.json",
|
|
"isomorphic-copy-wasm": "(copy src/wasm-lib/pkg/wasm_lib_bg.wasm public || cp src/wasm-lib/pkg/wasm_lib_bg.wasm public)",
|
|
"build:wasm-dev": "yarn wasm-prep && (cd src/wasm-lib && wasm-pack build --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt",
|
|
"build:wasm": "yarn wasm-prep && cd src/wasm-lib && wasm-pack build --release --target web --out-dir pkg && cargo test -p kcl-lib export_bindings && cd ../.. && yarn isomorphic-copy-wasm && yarn fmt",
|
|
"remove-importmeta": "sed -i 's/import.meta.url/window.location.origin/g' \"./src/wasm-lib/pkg/wasm_lib.js\"; sed -i '' 's/import.meta.url/window.location.origin/g' \"./src/wasm-lib/pkg/wasm_lib.js\" || echo \"sed for both mac and linux\"",
|
|
"wasm-prep": "rimraf src/wasm-lib/pkg && mkdirp src/wasm-lib/pkg && rimraf src/wasm-lib/kcl/bindings",
|
|
"lint-fix": "eslint --fix --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src",
|
|
"lint": "eslint --max-warnings 0 --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src",
|
|
"files:set-version": "echo \"$(jq --arg v \"$VERSION\" '.version=$v' package.json --indent 2)\" > package.json",
|
|
"files:set-notes": "./scripts/set-files-notes.sh",
|
|
"files:flip-to-nightly": "./scripts/flip-files-to-nightly.sh",
|
|
"files:invalidate-bucket": "./scripts/invalidate-files-bucket.sh",
|
|
"files:invalidate-bucket:nightly": "./scripts/invalidate-files-bucket.sh --nightly",
|
|
"postinstall": "yarn fetch:samples && yarn xstate:typegen && ./node_modules/.bin/electron-rebuild",
|
|
"xstate:typegen": "yarn xstate typegen \"src/**/*.ts?(x)\"",
|
|
"make:dev": "make dev",
|
|
"generate:machine-api": "npx openapi-typescript ./openapi/machine-api.json -o src/lib/machine-api.d.ts",
|
|
"tron:start": "electron-forge start",
|
|
"chrome:test": "PLATFORM=web NODE_ENV=development yarn playwright test --config=playwright.config.ts --project='Google Chrome' --grep-invert='@snapshot'",
|
|
"tronb:vite:dev": "vite build -c vite.main.config.ts -m development && vite build -c vite.preload.config.ts -m development && vite build -c vite.renderer.config.ts -m development",
|
|
"tronb:vite:prod": "vite build -c vite.main.config.ts && vite build -c vite.preload.config.ts && vite build -c vite.renderer.config.ts",
|
|
"tronb:package:dev": "yarn tronb:vite:dev && electron-builder --config electron-builder.yml",
|
|
"tronb:package:prod": "yarn tronb:vite:prod && electron-builder --config electron-builder.yml --publish always",
|
|
"test-setup": "yarn install && yarn build:wasm",
|
|
"test": "vitest --mode development",
|
|
"test:unit": "vitest run --mode development --exclude **/kclSamples.test.ts",
|
|
"test:unit:kcl-samples": "vitest run --mode development ./src/lang/kclSamples.test.ts",
|
|
"test:playwright:electron": "playwright test --config=playwright.electron.config.ts --grep-invert='@snapshot'",
|
|
"test:playwright:electron:windows": "playwright test --config=playwright.electron.config.ts --grep-invert=\"@skipWin|@snapshot\" --quiet",
|
|
"test:playwright:electron:macos": "playwright test --config=playwright.electron.config.ts --grep-invert='@skipMacos|@snapshot' --quiet",
|
|
"test:playwright:electron:ubuntu": "playwright test --config=playwright.electron.config.ts --grep-invert='@skipLinux|@snapshot' --quiet",
|
|
"test:playwright:electron:local": "yarn tronb:package:dev && NODE_ENV=development playwright test --config=playwright.electron.config.ts --grep-invert='@snapshot'",
|
|
"test:playwright:electron:windows:local": "yarn tronb:package:dev && set NODE_ENV='development' && playwright test --config=playwright.electron.config.ts --grep-invert=\"@skipWin|@snapshot\"",
|
|
"test:playwright:electron:macos:local": "yarn tronb:package:dev && NODE_ENV=development playwright test --config=playwright.electron.config.ts --grep-invert='@skipMacos|@snapshot'",
|
|
"test:playwright:electron:ubuntu:local": "yarn tronb:package:dev && NODE_ENV=development playwright test --config=playwright.electron.config.ts --grep-invert='@skipLinux|@snapshot'",
|
|
"test:unit:local": "yarn simpleserver:bg && yarn test:unit; kill-port 3000",
|
|
"test:unit:kcl-samples:local": "yarn simpleserver:bg && yarn test:unit:kcl-samples; kill-port 3000"
|
|
},
|
|
"prettier": {
|
|
"trailingComma": "es5",
|
|
"tabWidth": 2,
|
|
"semi": false,
|
|
"singleQuote": true
|
|
},
|
|
"browserslist": {
|
|
"production": [
|
|
">0.2%",
|
|
"not dead",
|
|
"not op_mini all"
|
|
],
|
|
"development": [
|
|
"last 1 chrome version",
|
|
"last 1 firefox version",
|
|
"last 1 safari version"
|
|
]
|
|
},
|
|
"devDependencies": {
|
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
|
"@babel/preset-env": "^7.25.4",
|
|
"@electron-forge/cli": "7.4.0",
|
|
"@electron-forge/plugin-fuses": "7.4.0",
|
|
"@electron-forge/plugin-vite": "7.4.0",
|
|
"@electron/fuses": "1.8.0",
|
|
"@iarna/toml": "^2.2.5",
|
|
"@lezer/generator": "^1.7.2",
|
|
"@nabla/vite-plugin-eslint": "^2.0.5",
|
|
"@playwright/test": "^1.49.0",
|
|
"@testing-library/jest-dom": "^5.14.1",
|
|
"@testing-library/react": "^15.0.2",
|
|
"@types/diff": "^6.0.0",
|
|
"@types/electron": "^1.6.10",
|
|
"@types/isomorphic-fetch": "^0.0.39",
|
|
"@types/minimist": "^1.2.5",
|
|
"@types/mocha": "^10.0.6",
|
|
"@types/node": "^22.7.8",
|
|
"@types/pixelmatch": "^5.2.6",
|
|
"@types/pngjs": "^6.0.4",
|
|
"@types/react": "^18.3.4",
|
|
"@types/react-dom": "^18.3.1",
|
|
"@types/react-modal": "^3.16.3",
|
|
"@types/three": "^0.172.0",
|
|
"@types/ua-parser-js": "^0.7.39",
|
|
"@types/uuid": "^9.0.8",
|
|
"@types/wicg-file-system-access": "^2023.10.5",
|
|
"@types/ws": "^8.5.13",
|
|
"@vitejs/plugin-react": "^4.3.0",
|
|
"@vitest/web-worker": "^1.5.0",
|
|
"@xstate/cli": "^0.5.17",
|
|
"autoprefixer": "^10.4.19",
|
|
"electron": "32.1.2",
|
|
"electron-builder": "24.13.3",
|
|
"electron-notarize": "1.2.2",
|
|
"eslint": "^8.0.1",
|
|
"eslint-plugin-css-modules": "^2.12.0",
|
|
"eslint-plugin-import": "^2.30.0",
|
|
"eslint-plugin-jest": "^28.10.0",
|
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
"eslint-plugin-react": "^7.37.3",
|
|
"eslint-plugin-react-hooks": "^5.1.0",
|
|
"eslint-plugin-suggest-no-throw": "^1.0.0",
|
|
"eslint-plugin-testing-library": "^7.1.1",
|
|
"happy-dom": "^16.3.0",
|
|
"http-server": "^14.1.1",
|
|
"husky": "^9.1.5",
|
|
"kill-port": "^2.0.1",
|
|
"node-fetch": "^3.3.2",
|
|
"pixelmatch": "^5.3.0",
|
|
"pngjs": "^7.0.0",
|
|
"postcss": "^8.4.43",
|
|
"postinstall-postinstall": "^2.1.0",
|
|
"prettier": "^2.8.8",
|
|
"setimmediate": "^1.0.5",
|
|
"tailwindcss": "^3.4.1",
|
|
"ts-node": "^10.0.0",
|
|
"typescript": "^5.7.3",
|
|
"typescript-eslint": "^8.19.1",
|
|
"vite": "^5.4.12",
|
|
"vite-plugin-package-version": "^1.1.0",
|
|
"vite-tsconfig-paths": "^4.3.2",
|
|
"vitest": "^1.6.0",
|
|
"vitest-webgl-canvas-mock": "^1.1.0",
|
|
"wasm-pack": "^0.13.1",
|
|
"ws": "^8.17.0",
|
|
"yarn": "^1.22.22"
|
|
},
|
|
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
}
|