Skip to content

Commit

Permalink
refactor: ts2jsdoc step2 (#657)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
dominikg and bluwy authored May 25, 2023
1 parent 962f22f commit 9685a62
Show file tree
Hide file tree
Showing 28 changed files with 15 additions and 20 deletions.
5 changes: 5 additions & 0 deletions .changeset/yellow-eggs-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/vite-plugin-svelte': minor
---

refactor: release vite-plugin-svelte as unbundled javascript with jsdoc types
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ module.exports = {
ecmaVersion: 2020
},
rules: {
'n/no-unsupported-features/es-builtins': 'error',
'n/no-unsupported-features/es-syntax': 'error',
'no-console': 'off',
'no-debugger': 'error',
'n/no-missing-import': [
Expand Down Expand Up @@ -57,7 +59,6 @@ module.exports = {
],
'n/no-unpublished-import': 'off',
'n/no-unpublished-require': 'off',
'n/no-unsupported-features/es-syntax': 'off',
'no-process-exit': 'off'
},
overrides: [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
if: matrix.node == 14
run: pnpm install --no-frozen-lockfile --prefer-offline --ignore-scripts
- name: build
run: pnpm build:ci
run: pnpm build
- name: install playwright chromium
run: pnpm playwright install chromium
- name: run tests
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"private": true,
"scripts": {
"dev": "pnpm --dir packages/vite-plugin-svelte dev",
"build:ci": "pnpm --dir packages/vite-plugin-svelte build:ci",
"build": "pnpm --dir packages/vite-plugin-svelte build",
"test": "run-s -c test:unit test:build test:serve",
"test:unit": "vitest run",
Expand Down
7 changes: 0 additions & 7 deletions packages/e2e-tests/vitestGlobalSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ const preserveArtifacts = !!process.env.TEST_PRESERVE_ARTIFACTS || isCI;

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

const buildPackagesUnderTest = async () => {
console.log('building packages');
await execa('pnpm', ['build:ci'], { stdio: 'inherit' });
console.log('building packages done');
};

const syncNodeModules = async () => {
// tests use symbolic linked node_modules directories. make sure the workspace is up for it
console.log('syncing node_modules');
Expand Down Expand Up @@ -50,7 +44,6 @@ export async function setup() {
console.log('');
console.log('preparing non ci env...');
await syncNodeModules();
await buildPackagesUnderTest();
console.log('preparations done');
}
console.log('Starting playwright server ...');
Expand Down
15 changes: 6 additions & 9 deletions packages/vite-plugin-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,20 @@
"license": "MIT",
"author": "dominikg",
"files": [
"dist",
"src",
"*.d.ts"
"src"
],
"type": "module",
"types": "dist/index.d.ts",
"types": "src/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
"types": "./src/index.d.ts",
"import": "./src/index.js"
},
"./package.json": "./package.json"
},
"scripts": {
"dev": "pnpm build:ci --sourcemap --watch src",
"build:ci": "rimraf dist && tsup-node src/index.ts --format esm",
"build": "pnpm build:ci --dts --sourcemap",
"dev": "pnpm typecheck --watch",
"build": "pnpm typecheck",
"typecheck": "tsc --noEmit --allowJs --checkJs"
},
"engines": {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function loadSvelteConfig(viteConfig, inlineOptions) {
try {
// identify which require function to use (esm and cjs mode)
const _require = import.meta.url
? (esmRequire ??= createRequire(import.meta.url))
? esmRequire ?? (esmRequire = createRequire(import.meta.url))
: require;

// avoid loading cached version on reload
Expand Down

0 comments on commit 9685a62

Please sign in to comment.