Skip to content

Commit 9685a62

Browse files
dominikgbluwy
andauthored
refactor: ts2jsdoc step2 (#657)
* refactor: move types to .d.ts files in preparation of ts-to-jsdoc * wip: convert ts to jsdoc * wip: ts to jsdoc * wip: ts to jsdoc conversion * wip: finished jsdoc conversion, renamed .d.ts files to avoid collisions, added .js ext to imports * test: add small wait for inspector icon to become visible to avoid flakiness in tests * wip: move internal types into src/types, improve index.d.ts * wip: move unit tests out of src dir and update filters * chore: switch to eslint-plugin-n to get rid of some errors * refactor: update jsdoc syntax (#656) * refactor: rename prepared .ts files to .js, update scripts, add changeset * fix: replace nullish assignment (requires node15) and enable error rules for invalid syntax that isn't downleveled anymore * chore: fix types path --------- Co-authored-by: Bjorn Lu <[email protected]>
1 parent 962f22f commit 9685a62

28 files changed

+15
-20
lines changed

.changeset/yellow-eggs-rush.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/vite-plugin-svelte': minor
3+
---
4+
5+
refactor: release vite-plugin-svelte as unbundled javascript with jsdoc types

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ module.exports = {
2222
ecmaVersion: 2020
2323
},
2424
rules: {
25+
'n/no-unsupported-features/es-builtins': 'error',
26+
'n/no-unsupported-features/es-syntax': 'error',
2527
'no-console': 'off',
2628
'no-debugger': 'error',
2729
'n/no-missing-import': [
@@ -57,7 +59,6 @@ module.exports = {
5759
],
5860
'n/no-unpublished-import': 'off',
5961
'n/no-unpublished-require': 'off',
60-
'n/no-unsupported-features/es-syntax': 'off',
6162
'no-process-exit': 'off'
6263
},
6364
overrides: [

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
if: matrix.node == 14
113113
run: pnpm install --no-frozen-lockfile --prefer-offline --ignore-scripts
114114
- name: build
115-
run: pnpm build:ci
115+
run: pnpm build
116116
- name: install playwright chromium
117117
run: pnpm playwright install chromium
118118
- name: run tests

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"private": true,
44
"scripts": {
55
"dev": "pnpm --dir packages/vite-plugin-svelte dev",
6-
"build:ci": "pnpm --dir packages/vite-plugin-svelte build:ci",
76
"build": "pnpm --dir packages/vite-plugin-svelte build",
87
"test": "run-s -c test:unit test:build test:serve",
98
"test:unit": "vitest run",

packages/e2e-tests/vitestGlobalSetup.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ const preserveArtifacts = !!process.env.TEST_PRESERVE_ARTIFACTS || isCI;
1414

1515
const DIR = path.join(os.tmpdir(), 'vitest_playwright_global_setup');
1616

17-
const buildPackagesUnderTest = async () => {
18-
console.log('building packages');
19-
await execa('pnpm', ['build:ci'], { stdio: 'inherit' });
20-
console.log('building packages done');
21-
};
22-
2317
const syncNodeModules = async () => {
2418
// tests use symbolic linked node_modules directories. make sure the workspace is up for it
2519
console.log('syncing node_modules');
@@ -50,7 +44,6 @@ export async function setup() {
5044
console.log('');
5145
console.log('preparing non ci env...');
5246
await syncNodeModules();
53-
await buildPackagesUnderTest();
5447
console.log('preparations done');
5548
}
5649
console.log('Starting playwright server ...');

packages/vite-plugin-svelte/package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,20 @@
44
"license": "MIT",
55
"author": "dominikg",
66
"files": [
7-
"dist",
8-
"src",
9-
"*.d.ts"
7+
"src"
108
],
119
"type": "module",
12-
"types": "dist/index.d.ts",
10+
"types": "src/index.d.ts",
1311
"exports": {
1412
".": {
15-
"types": "./dist/index.d.ts",
16-
"import": "./dist/index.js"
13+
"types": "./src/index.d.ts",
14+
"import": "./src/index.js"
1715
},
1816
"./package.json": "./package.json"
1917
},
2018
"scripts": {
21-
"dev": "pnpm build:ci --sourcemap --watch src",
22-
"build:ci": "rimraf dist && tsup-node src/index.ts --format esm",
23-
"build": "pnpm build:ci --dts --sourcemap",
19+
"dev": "pnpm typecheck --watch",
20+
"build": "pnpm typecheck",
2421
"typecheck": "tsc --noEmit --allowJs --checkJs"
2522
},
2623
"engines": {

packages/vite-plugin-svelte/src/utils/load-svelte-config.ts renamed to packages/vite-plugin-svelte/src/utils/load-svelte-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export async function loadSvelteConfig(viteConfig, inlineOptions) {
5858
try {
5959
// identify which require function to use (esm and cjs mode)
6060
const _require = import.meta.url
61-
? (esmRequire ??= createRequire(import.meta.url))
61+
? esmRequire ?? (esmRequire = createRequire(import.meta.url))
6262
: require;
6363

6464
// avoid loading cached version on reload

0 commit comments

Comments
 (0)