Skip to content

chore: cleanup after jsdoc #659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3fcaac4
refactor: move types to .d.ts files in preparation of ts-to-jsdoc
dominikg May 15, 2023
306e2b4
Merge branch 'main' into refactor/ts2jsdoc
dominikg May 18, 2023
324f3aa
wip: convert ts to jsdoc
dominikg May 19, 2023
431d126
wip: ts to jsdoc
dominikg May 19, 2023
7e7c7d9
wip: ts to jsdoc conversion
dominikg May 20, 2023
b692718
wip: finished jsdoc conversion, renamed .d.ts files to avoid collisio…
dominikg May 21, 2023
8cd221e
Merge branch 'main' into refactor/ts2jsdoc
dominikg May 22, 2023
770cee0
test: add small wait for inspector icon to become visible to avoid fl…
dominikg May 22, 2023
7c42425
Merge branch 'fix/flaky-inspector-test' into refactor/ts2jsdoc
dominikg May 22, 2023
b04e577
wip: move internal types into src/types, improve index.d.ts
dominikg May 22, 2023
5a14424
wip: move unit tests out of src dir and update filters
dominikg May 22, 2023
69272c8
chore: switch to eslint-plugin-n to get rid of some errors
dominikg May 22, 2023
fbfdd5c
refactor: update jsdoc syntax (#656)
bluwy May 23, 2023
f4e6655
Merge branch 'main' into refactor/ts2jsdoc
dominikg May 23, 2023
1d98fb5
refactor: rename prepared .ts files to .js, update scripts, add chang…
dominikg May 23, 2023
187b57b
fix: replace nullish assignment (requires node15) and enable error ru…
dominikg May 23, 2023
0c59fa8
chore: fix types path
bluwy May 24, 2023
ec94dba
Merge branch 'main' into refactor/ts2jsdoc-step2
dominikg May 24, 2023
8a5b7cb
remove tsup
dominikg May 24, 2023
9c7c0a7
chore(types): replace rollup types with vite reexport
dominikg May 24, 2023
c2d8999
chore: improve utility scripts, add publint
dominikg May 24, 2023
7cbd963
Merge branch 'main' into refactor/cleanup-after-jsdoc
dominikg May 25, 2023
fb89a96
chore: call check:types and check:publint in public packages via filter
dominikg May 25, 2023
0495bbb
chore: disable tsc emit in inspector
dominikg May 25, 2023
b0db7d7
chore: remove noop build script
dominikg May 25, 2023
5c4650b
chore: actually enable parallel processing for checks
dominikg May 25, 2023
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
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = {
'n/no-extraneous-import': [
'error',
{
allowModules: ['vite']
allowModules: ['vite', 'vitest']
}
],
'n/no-extraneous-require': [
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,22 @@ jobs:
cache-dependency-path: '**/pnpm-lock.yaml'
- name: install
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
- name: build
id: build
run: pnpm build
- name: format
run: pnpm check:format
- name: lint
if: (${{ success() }} || ${{ failure() }})
run: pnpm lint
run: pnpm check:lint
- name: types
if: (${{ success() }} || ${{ failure() }})
run: pnpm check:types
- name: audit
if: (${{ success() }} || ${{ failure() }})
run: pnpm audit
run: pnpm check:audit
- name: publint
if: (${{ success() }} || ${{ failure() }})
run: pnpm check:publint

# this is the test matrix, it runs with node16 on linux,windows,macos + node14,18 on linux
# it is skipped if the build step of the checks job wasn't successful (still runs if lint or audit fail)
test:
needs: checks
if: (${{ success() }} || ${{ failure() }}) && (${{ needs.checks.output.build_successful }})
timeout-minutes: 10
runs-on: ${{ matrix.os }}
strategy:
Expand Down Expand Up @@ -111,8 +112,6 @@ jobs:
- name: install for node14
if: matrix.node == 14
run: pnpm install --no-frozen-lockfile --prefer-offline --ignore-scripts
- name: build
run: pnpm build
- name: install playwright chromium
run: pnpm playwright install chromium
- name: run tests
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ temp
**/temp
*.tmp
**/*.tmp
.eslintcache

# build and dist
build
Expand Down
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
aggregate-output=true
reporter=append-only
26 changes: 14 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@
"name": "vite-plugin-svelte-monorepo",
"private": true,
"scripts": {
"dev": "pnpm --dir packages/vite-plugin-svelte dev",
"build": "pnpm --dir packages/vite-plugin-svelte build",
"test": "run-s -c test:unit test:build test:serve",
"test:unit": "vitest run",
"test:serve": "vitest run -c vitest.config.e2e.ts",
"test:build": "cross-env TEST_BUILD=1 vitest run -c vitest.config.e2e.ts",
"lint": "eslint --ignore-path .gitignore '**/*.{js,ts,svelte,html,svx,md}'",
"lint:fix": "pnpm lint --fix",
"format": "prettier --ignore-path .gitignore '**/*.{css,scss,svelte,html,js,ts,svx,md}' --check",
"format:fix": "pnpm format --write",
"fixup": "run-s lint:fix format:fix",
"release": "pnpm build && pnpm changeset publish",
"check": "run-p -c check:*",
"check:audit": "pnpm audit --prod",
"check:publint": "pnpm --filter \"./packages/*\" --parallel check:publint",
"check:types": "pnpm --filter \"./packages/*\" --parallel check:types",
"check:lint": "eslint --cache --ignore-path .gitignore '**/*.{js,ts,svelte,html,svx,md}'",
"check:format": "prettier --cache --ignore-path .gitignore '**/*.{css,scss,svelte,html,js,ts,svx,md}' --check",
"lint": "pnpm check:lint --fix",
"format": "pnpm check:format --write",
"fixup": "run-s lint format",
"release": "pnpm changeset publish",
"prepare": "husky install"
},
"devDependencies": {
Expand Down Expand Up @@ -42,16 +44,17 @@
"playwright-core": "^1.33.0",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.0",
"publint": "^0.1.12",
"rimraf": "^5.0.0",
"svelte": "^3.59.1",
"typescript": "^5.0.4",
"vite": "^4.3.5",
"vitest": "^0.31.0"
},
"lint-staged": {
"*.{js,ts,svelte,html,md,svx}": "eslint --fix",
"*.{js,ts,svelte,html,md,svx}": "eslint --cache --fix",
"*.{css,scss,svelte,html,js,ts,svx,md}": [
"prettier --write"
"prettier --cache --write"
]
},
"packageManager": "pnpm@8.5.0",
Expand All @@ -61,8 +64,7 @@
},
"pnpm": {
"overrides": {
"@sveltejs/vite-plugin-svelte": "workspace:^",
"tsup>postcss-load-config@<4": "^4.0.0"
"@sveltejs/vite-plugin-svelte": "workspace:^"
},
"peerDependencyRules": {
"allowedVersions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"name": "e2e-test-dep-svelte-nested",
"svelte": "src/index.js",
"main": "src/index.js",
"type": "module",
"files": [
"src"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/vite-ssr/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
</head>
<body>
<div id="svelte"><!--app-outlet--></div>
<script type="module" src="/src/entry-client.js"></script>
<script type="module" src="/src/entry-client.mjs"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion packages/e2e-tests/vite-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dev": "node server",
"build": "pnpm build:client && pnpm build:server",
"build:client": "vite build --ssrManifest --outDir dist/client",
"build:server": "vite build --ssr src/entry-server.js --outDir dist/server",
"build:server": "vite build --ssr src/entry-server.mjs --outDir dist/server",
"preview": "cross-env NODE_ENV=production node server",
"debug": "node --inspect-brk server"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/vite-ssr/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async function createServer(root = process.cwd(), isProd = process.env.NODE_ENV
// always read fresh template in dev
template = fs.readFileSync(resolve('index.html'), 'utf-8');
template = await vite.transformIndexHtml(url, template);
render = (await vite.ssrLoadModule('/src/entry-server.js')).render;
render = (await vite.ssrLoadModule('/src/entry-server.mjs')).render;
} else {
template = indexProd;
// @ts-ignore
Expand Down
4 changes: 4 additions & 0 deletions packages/vite-plugin-svelte-inspector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"import": "./src/index.js"
}
},
"scripts": {
"check:publint": "publint --strict",
"check:types": "tsc --noEmit"
},
"engines": {
"node": "^14.18.0 || >= 16"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-expect-error missing
// eslint-disable-next-line n/no-missing-import
import Inspector from 'virtual:svelte-inspector-path:Inspector.svelte';

Expand Down
6 changes: 4 additions & 2 deletions packages/vite-plugin-svelte-inspector/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"include": ["src"],
"exclude": ["**/*.spec.ts"],
"compilerOptions": {
"outDir": "dist",
"noEmit": true,
"target": "ES2020",
"module": "ES2020",
"moduleResolution": "node",
Expand All @@ -14,6 +14,8 @@
"baseUrl": ".",
"resolveJsonModule": true,
// see https://devblogs.microsoft.com/typescript/announcing-typescript-4-4-beta/#use-unknown-catch-variables
"useUnknownInCatchVariables": false
"useUnknownInCatchVariables": false,
"allowJs": true,
"checkJs": true
}
}
7 changes: 2 additions & 5 deletions packages/vite-plugin-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
"./package.json": "./package.json"
},
"scripts": {
"dev": "pnpm typecheck --watch",
"build": "pnpm typecheck",
"typecheck": "tsc --noEmit --allowJs --checkJs"
"check:publint": "publint --strict",
"check:types": "tsc --noEmit"
},
"engines": {
"node": "^14.18.0 || >= 16"
Expand Down Expand Up @@ -54,9 +53,7 @@
"devDependencies": {
"@types/debug": "^4.1.7",
"esbuild": "^0.17.18",
"rollup": "^3.21.6",
"svelte": "^3.59.1",
"tsup": "^6.7.0",
"vite": "^4.3.5"
}
}
2 changes: 1 addition & 1 deletion packages/vite-plugin-svelte/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function svelte(inlineOptions) {
let compileSvelte;
/* eslint-enable no-unused-vars */

/** @type {Promise<import('rollup').PartialResolvedId | null>} */
/** @type {Promise<import('vite').Rollup.PartialResolvedId | null>} */
let resolvedSvelteSSR;
/** @type {Set<string>} */
let packagesWithResolveWarnings;
Expand Down
4 changes: 2 additions & 2 deletions packages/vite-plugin-svelte/src/utils/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { buildExtendedLogMessage } from './log.js';
* convert an error thrown by svelte.compile to a RollupError so that vite displays it in a user friendly way
* @param {import('svelte/types/compiler/interfaces').Warning & Error} error a svelte compiler error, which is a mix of Warning and an error
* @param {import('../types/options.d.ts').ResolvedOptions} options
* @returns {import('rollup').RollupError} the converted error
* @returns {import('vite').Rollup.RollupError} the converted error
*/
export function toRollupError(error, options) {
const { filename, frame, start, code, name, stack } = error;
/** @type {import('rollup').RollupError} */
/** @type {import('vite').Rollup.RollupError} */
const rollupError = {
name, // needed otherwise sveltekit coalesce_to_error turns it into a string
id: filename,
Expand Down
2 changes: 1 addition & 1 deletion packages/vite-plugin-svelte/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"include": ["src"],
"exclude": ["**/*.spec.ts"],
"compilerOptions": {
"outDir": "dist",
"noEmit": true,
"target": "ES2020",
"module": "ES2020",
"moduleResolution": "node",
Expand Down
Loading