@sveltejs/vite-plugin-svelte 1.0.0-next.43 → 1.0.0-next.46
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/dist/index.cjs +64 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +63 -44
- package/dist/index.js.map +1 -1
- package/package.json +11 -12
- package/src/ui/inspector/Inspector.svelte +25 -9
- package/src/ui/inspector/{load-inspector.ts → load-inspector.js} +1 -2
- package/src/ui/inspector/plugin.ts +37 -32
- package/src/utils/__tests__/dependencies.spec.ts +7 -4
- package/src/utils/__tests__/sourcemap.spec.ts +1 -0
- package/src/utils/compile.ts +2 -1
- package/src/utils/options.ts +26 -6
- package/src/ui/inspector/icon.svg +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/vite-plugin-svelte",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.46",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "dominikg",
|
|
6
6
|
"files": [
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"debug": "^4.3.4",
|
|
46
46
|
"deepmerge": "^4.2.2",
|
|
47
47
|
"kleur": "^4.1.4",
|
|
48
|
-
"magic-string": "^0.26.
|
|
49
|
-
"svelte-hmr": "^0.14.
|
|
48
|
+
"magic-string": "^0.26.2",
|
|
49
|
+
"svelte-hmr": "^0.14.12"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"diff-match-patch": "^1.0.5",
|
|
@@ -62,16 +62,15 @@
|
|
|
62
62
|
"@types/debug": "^4.1.7",
|
|
63
63
|
"@types/diff-match-patch": "^1.0.32",
|
|
64
64
|
"diff-match-patch": "^1.0.5",
|
|
65
|
-
"esbuild": "^0.14.
|
|
66
|
-
"rollup": "^2.
|
|
67
|
-
"svelte": "^3.
|
|
68
|
-
"tsup": "^5.12.
|
|
69
|
-
"vite": "^2.9.
|
|
65
|
+
"esbuild": "^0.14.39",
|
|
66
|
+
"rollup": "^2.74.1",
|
|
67
|
+
"svelte": "^3.48.0",
|
|
68
|
+
"tsup": "^5.12.8",
|
|
69
|
+
"vite": "^2.9.9"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
|
-
"dev": "pnpm
|
|
72
|
+
"dev": "pnpm build:ci --sourcemap --watch src",
|
|
73
73
|
"build:ci": "rimraf dist && tsup-node src/index.ts --format esm,cjs --no-splitting --target node14",
|
|
74
|
-
"build": "pnpm
|
|
75
|
-
}
|
|
76
|
-
"readme": "# @sveltejs/vite-plugin-svelte\n\nThe official [Svelte](https://svelte.dev) plugin for [Vite](https://vitejs.dev).\n\n## Usage\n\n```js\n// vite.config.js\nimport { defineConfig } from 'vite';\nimport { svelte } from '@sveltejs/vite-plugin-svelte';\n\nexport default defineConfig({\n plugins: [\n svelte({\n /* plugin options */\n })\n ]\n});\n```\n\n## Documentation\n\n- [Plugin options](../../docs/config.md)\n- [FAQ](../../docs/faq.md)\n\n## License\n\n[MIT](./LICENSE)\n"
|
|
74
|
+
"build": "pnpm build:ci --dts --sourcemap"
|
|
75
|
+
}
|
|
77
76
|
}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
// do not use TS here so that this component works in non-ts projects too
|
|
3
3
|
import { onMount } from 'svelte';
|
|
4
|
-
// @ts-expect-error virtual import is resolved by vite-plugin-svelte-inspector
|
|
5
|
-
// eslint-disable-next-line node/no-missing-import
|
|
6
|
-
import icon from 'virtual:svelte-inspector:icon.svg';
|
|
7
|
-
// @ts-expect-error virtual import is resolved by vite-plugin-svelte-inspector
|
|
8
4
|
// eslint-disable-next-line node/no-missing-import
|
|
9
5
|
import options from 'virtual:svelte-inspector-options';
|
|
10
6
|
const toggle_combo = options.toggleKeyCombo?.toLowerCase().split('-');
|
|
11
7
|
|
|
12
8
|
let enabled = false;
|
|
13
9
|
|
|
10
|
+
const icon = `data:image/svg+xml;base64,${btoa(
|
|
11
|
+
`
|
|
12
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="21" height="25" viewBox="0 0 107 128">
|
|
13
|
+
<title>svelte-inspector-logo</title>
|
|
14
|
+
<path d="M94.1566,22.8189c-10.4-14.8851-30.94-19.2971-45.7914-9.8348L22.2825,29.6078A29.9234,29.9234,0,0,0,8.7639,49.6506a31.5136,31.5136,0,0,0,3.1076,20.2318A30.0061,30.0061,0,0,0,7.3953,81.0653a31.8886,31.8886,0,0,0,5.4473,24.1157c10.4022,14.8865,30.9423,19.2966,45.7914,9.8348L84.7167,98.3921A29.9177,29.9177,0,0,0,98.2353,78.3493,31.5263,31.5263,0,0,0,95.13,58.117a30,30,0,0,0,4.4743-11.1824,31.88,31.88,0,0,0-5.4473-24.1157" style="fill:#ff3e00"/><path d="M45.8171,106.5815A20.7182,20.7182,0,0,1,23.58,98.3389a19.1739,19.1739,0,0,1-3.2766-14.5025,18.1886,18.1886,0,0,1,.6233-2.4357l.4912-1.4978,1.3363.9815a33.6443,33.6443,0,0,0,10.203,5.0978l.9694.2941-.0893.9675a5.8474,5.8474,0,0,0,1.052,3.8781,6.2389,6.2389,0,0,0,6.6952,2.485,5.7449,5.7449,0,0,0,1.6021-.7041L69.27,76.281a5.4306,5.4306,0,0,0,2.4506-3.631,5.7948,5.7948,0,0,0-.9875-4.3712,6.2436,6.2436,0,0,0-6.6978-2.4864,5.7427,5.7427,0,0,0-1.6.7036l-9.9532,6.3449a19.0329,19.0329,0,0,1-5.2965,2.3259,20.7181,20.7181,0,0,1-22.2368-8.2427,19.1725,19.1725,0,0,1-3.2766-14.5024,17.9885,17.9885,0,0,1,8.13-12.0513L55.8833,23.7472a19.0038,19.0038,0,0,1,5.3-2.3287A20.7182,20.7182,0,0,1,83.42,29.6611a19.1739,19.1739,0,0,1,3.2766,14.5025,18.4,18.4,0,0,1-.6233,2.4357l-.4912,1.4978-1.3356-.98a33.6175,33.6175,0,0,0-10.2037-5.1l-.9694-.2942.0893-.9675a5.8588,5.8588,0,0,0-1.052-3.878,6.2389,6.2389,0,0,0-6.6952-2.485,5.7449,5.7449,0,0,0-1.6021.7041L37.73,51.719a5.4218,5.4218,0,0,0-2.4487,3.63,5.7862,5.7862,0,0,0,.9856,4.3717,6.2437,6.2437,0,0,0,6.6978,2.4864,5.7652,5.7652,0,0,0,1.602-.7041l9.9519-6.3425a18.978,18.978,0,0,1,5.2959-2.3278,20.7181,20.7181,0,0,1,22.2368,8.2427,19.1725,19.1725,0,0,1,3.2766,14.5024,17.9977,17.9977,0,0,1-8.13,12.0532L51.1167,104.2528a19.0038,19.0038,0,0,1-5.3,2.3287" style="fill:#fff"/>
|
|
15
|
+
<polygon points="0,0 15,40 40,20" stroke="#ff3e00" fill="#ff3e00"></polygon>
|
|
16
|
+
</svg>
|
|
17
|
+
`
|
|
18
|
+
.replace(/[\n\r\t\s]+/g, ' ')
|
|
19
|
+
.trim()
|
|
20
|
+
)}`;
|
|
21
|
+
|
|
14
22
|
// location of code in file
|
|
15
23
|
let file_loc;
|
|
16
24
|
// cursor pos and width for file_loc overlay positioning
|
|
@@ -91,7 +99,7 @@
|
|
|
91
99
|
}
|
|
92
100
|
|
|
93
101
|
function keydown(event) {
|
|
94
|
-
if (event.repeat) {
|
|
102
|
+
if (event.repeat || event.key === undefined) {
|
|
95
103
|
return;
|
|
96
104
|
}
|
|
97
105
|
|
|
@@ -131,7 +139,6 @@
|
|
|
131
139
|
const b = document.body;
|
|
132
140
|
if (options.customStyles) {
|
|
133
141
|
b.classList.add('svelte-inspector-enabled');
|
|
134
|
-
b.style.setProperty('--svelte-inspector-cursor', `url(${JSON.stringify(icon)})`);
|
|
135
142
|
}
|
|
136
143
|
listeners(b, enabled);
|
|
137
144
|
}
|
|
@@ -143,12 +150,17 @@
|
|
|
143
150
|
listeners(b, enabled);
|
|
144
151
|
if (options.customStyles) {
|
|
145
152
|
b.classList.remove('svelte-inspector-enabled');
|
|
146
|
-
b.style.removeProperty('--svelte-inspector-cursor');
|
|
147
153
|
active_el?.classList.remove('svelte-inspector-active-target');
|
|
148
154
|
}
|
|
155
|
+
active_el = null;
|
|
149
156
|
}
|
|
150
157
|
|
|
151
158
|
onMount(() => {
|
|
159
|
+
const s = document.createElement('style');
|
|
160
|
+
s.setAttribute('type', 'text/css');
|
|
161
|
+
s.setAttribute('id', 'svelte-inspector-style');
|
|
162
|
+
s.textContent = `:root { --svelte-inspector-icon: url(${icon})};`;
|
|
163
|
+
document.head.append(s);
|
|
152
164
|
if (toggle_combo) {
|
|
153
165
|
document.body.addEventListener('keydown', keydown);
|
|
154
166
|
if (options.holdMode) {
|
|
@@ -158,6 +170,10 @@
|
|
|
158
170
|
return () => {
|
|
159
171
|
// make sure we get rid of everything
|
|
160
172
|
disable();
|
|
173
|
+
const s = document.head.querySelector('#svelte-inspector-style');
|
|
174
|
+
if (s) {
|
|
175
|
+
document.head.removeChild(s);
|
|
176
|
+
}
|
|
161
177
|
if (toggle_combo) {
|
|
162
178
|
document.body.removeEventListener('keydown', keydown);
|
|
163
179
|
if (options.holdMode) {
|
|
@@ -172,7 +188,7 @@
|
|
|
172
188
|
<div
|
|
173
189
|
class="svelte-inspector-toggle"
|
|
174
190
|
class:enabled
|
|
175
|
-
style={`background-image:
|
|
191
|
+
style={`background-image: var(--svelte-inspector-icon);${options.toggleButtonPos
|
|
176
192
|
.split('-')
|
|
177
193
|
.map((p) => `${p}: 8px;`)
|
|
178
194
|
.join('')}`}
|
|
@@ -193,7 +209,7 @@
|
|
|
193
209
|
|
|
194
210
|
<style>
|
|
195
211
|
:global(body.svelte-inspector-enabled *) {
|
|
196
|
-
cursor: var(--svelte-inspector-
|
|
212
|
+
cursor: var(--svelte-inspector-icon), crosshair !important;
|
|
197
213
|
}
|
|
198
214
|
:global(.svelte-inspector-active-target) {
|
|
199
215
|
outline: 2px dashed #ff3e00 !important;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// @ts-expect-error virtual import is resolved by vite-plugin-svelte-inspector
|
|
2
1
|
// eslint-disable-next-line node/no-missing-import
|
|
3
|
-
import Inspector from 'virtual:svelte-inspector:Inspector.svelte';
|
|
2
|
+
import Inspector from 'virtual:svelte-inspector-path:Inspector.svelte';
|
|
4
3
|
|
|
5
4
|
function create_inspector_host() {
|
|
6
5
|
const id = 'svelte-inspector-host';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Plugin } from 'vite';
|
|
1
|
+
import { Plugin, normalizePath } from 'vite';
|
|
3
2
|
import { log } from '../../utils/log';
|
|
4
3
|
import { InspectorOptions } from '../../utils/options';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import fs from 'fs';
|
|
5
7
|
|
|
6
8
|
const defaultInspectorOptions: InspectorOptions = {
|
|
7
9
|
toggleKeyCombo: process.platform === 'win32' ? 'control-shift' : 'meta-shift',
|
|
@@ -11,11 +13,17 @@ const defaultInspectorOptions: InspectorOptions = {
|
|
|
11
13
|
customStyles: true
|
|
12
14
|
};
|
|
13
15
|
|
|
16
|
+
function getInspectorPath() {
|
|
17
|
+
const pluginPath = normalizePath(path.dirname(fileURLToPath(import.meta.url)));
|
|
18
|
+
return pluginPath.replace(/\/vite-plugin-svelte\/dist$/, '/vite-plugin-svelte/src/ui/inspector/');
|
|
19
|
+
}
|
|
20
|
+
|
|
14
21
|
export function svelteInspector(): Plugin {
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
const inspectorPath = getInspectorPath();
|
|
23
|
+
log.debug.enabled && log.debug(`svelte inspector path: ${inspectorPath}`);
|
|
17
24
|
let inspectorOptions: InspectorOptions;
|
|
18
|
-
let
|
|
25
|
+
let appendTo: string | undefined;
|
|
26
|
+
let disabled = false;
|
|
19
27
|
|
|
20
28
|
return {
|
|
21
29
|
name: 'vite-plugin-svelte:inspector',
|
|
@@ -31,55 +39,52 @@ export function svelteInspector(): Plugin {
|
|
|
31
39
|
};
|
|
32
40
|
}
|
|
33
41
|
if (!vps || !inspectorOptions) {
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
log.debug('inspector disabled, could not find config');
|
|
43
|
+
disabled = true;
|
|
36
44
|
} else {
|
|
37
|
-
root = config.root || process.cwd();
|
|
38
|
-
rootRequire = createRequire(root);
|
|
39
45
|
if (vps.api.options.kit && !inspectorOptions.appendTo) {
|
|
40
|
-
const out_dir = vps.api.options.kit.outDir || '.svelte-kit';
|
|
46
|
+
const out_dir = path.basename(vps.api.options.kit.outDir || '.svelte-kit');
|
|
41
47
|
inspectorOptions.appendTo = `${out_dir}/runtime/client/start.js`;
|
|
42
48
|
}
|
|
43
|
-
|
|
49
|
+
appendTo = inspectorOptions.appendTo;
|
|
44
50
|
}
|
|
45
51
|
},
|
|
46
52
|
|
|
47
53
|
async resolveId(importee: string, importer, options) {
|
|
48
|
-
if (options?.ssr) {
|
|
54
|
+
if (options?.ssr || disabled) {
|
|
49
55
|
return;
|
|
50
56
|
}
|
|
51
|
-
if (importee
|
|
57
|
+
if (importee.startsWith('virtual:svelte-inspector-options')) {
|
|
52
58
|
return importee;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
'virtual:svelte-inspector:',
|
|
58
|
-
'@sveltejs/vite-plugin-svelte/src/ui/inspector/'
|
|
59
|
-
);
|
|
60
|
-
const path = rootRequire.resolve(file);
|
|
61
|
-
if (path) {
|
|
62
|
-
return path;
|
|
63
|
-
} else {
|
|
64
|
-
log.error.once(`failed to resolve ${file} for ${importee} from ${root}`);
|
|
65
|
-
}
|
|
59
|
+
} else if (importee.startsWith('virtual:svelte-inspector-path:')) {
|
|
60
|
+
const resolved = importee.replace('virtual:svelte-inspector-path:', inspectorPath);
|
|
61
|
+
log.debug.enabled && log.debug(`resolved ${importee} with ${resolved}`);
|
|
62
|
+
return resolved;
|
|
66
63
|
}
|
|
67
64
|
},
|
|
68
|
-
|
|
65
|
+
|
|
66
|
+
async load(id, options) {
|
|
67
|
+
if (options?.ssr || disabled) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
69
70
|
if (id === 'virtual:svelte-inspector-options') {
|
|
70
71
|
return `export default ${JSON.stringify(inspectorOptions ?? {})}`;
|
|
72
|
+
} else if (id.startsWith(inspectorPath)) {
|
|
73
|
+
// read file ourselves to avoid getting shut out by vites fs.allow check
|
|
74
|
+
return await fs.promises.readFile(id, 'utf-8');
|
|
71
75
|
}
|
|
72
76
|
},
|
|
77
|
+
|
|
73
78
|
transform(code: string, id: string, options?: { ssr?: boolean }) {
|
|
74
|
-
if (options?.ssr || !
|
|
79
|
+
if (options?.ssr || disabled || !appendTo) {
|
|
75
80
|
return;
|
|
76
81
|
}
|
|
77
|
-
if (id.endsWith(
|
|
78
|
-
return { code: `${code}\nimport 'virtual:svelte-inspector:load-inspector.
|
|
82
|
+
if (id.endsWith(appendTo)) {
|
|
83
|
+
return { code: `${code}\nimport 'virtual:svelte-inspector-path:load-inspector.js'` };
|
|
79
84
|
}
|
|
80
85
|
},
|
|
81
86
|
transformIndexHtml(html) {
|
|
82
|
-
if (
|
|
87
|
+
if (disabled || appendTo) {
|
|
83
88
|
return;
|
|
84
89
|
}
|
|
85
90
|
return {
|
|
@@ -91,7 +96,7 @@ export function svelteInspector(): Plugin {
|
|
|
91
96
|
attrs: {
|
|
92
97
|
type: 'module',
|
|
93
98
|
// /@id/ is needed, otherwise the virtual: is seen as protocol by browser and cors error happens
|
|
94
|
-
src: '/@id/virtual:svelte-inspector:load-inspector.
|
|
99
|
+
src: '/@id/virtual:svelte-inspector-path:load-inspector.js'
|
|
95
100
|
}
|
|
96
101
|
}
|
|
97
102
|
]
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
1
2
|
import { findRootSvelteDependencies, needsOptimization } from '../dependencies';
|
|
2
3
|
import * as path from 'path';
|
|
3
4
|
import { createRequire } from 'module';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
const __dir = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const e2eTestRoot = path.resolve(__dir, '../../../../../packages/e2e-tests');
|
|
4
8
|
|
|
5
9
|
describe('dependencies', () => {
|
|
6
10
|
describe('findRootSvelteDependencies', () => {
|
|
@@ -11,9 +15,7 @@ describe('dependencies', () => {
|
|
|
11
15
|
expect(deps[0].path).toEqual([]);
|
|
12
16
|
});
|
|
13
17
|
it('should find nested svelte dependencies in packages/e2e-test/package-json-svelte-field', () => {
|
|
14
|
-
const deps = findRootSvelteDependencies(
|
|
15
|
-
path.resolve('packages/e2e-tests/package-json-svelte-field')
|
|
16
|
-
);
|
|
18
|
+
const deps = findRootSvelteDependencies(path.join(e2eTestRoot, 'package-json-svelte-field'));
|
|
17
19
|
expect(deps).toHaveLength(3);
|
|
18
20
|
const hybrid = deps.find((dep) => dep.name === 'e2e-test-dep-svelte-hybrid');
|
|
19
21
|
expect(hybrid).toBeTruthy();
|
|
@@ -29,7 +31,8 @@ describe('dependencies', () => {
|
|
|
29
31
|
});
|
|
30
32
|
describe('needsOptimization', () => {
|
|
31
33
|
it('should optimize cjs deps only', () => {
|
|
32
|
-
const
|
|
34
|
+
const testDepsPath = path.join(e2eTestRoot, 'dependencies/package.json');
|
|
35
|
+
const localRequire = createRequire(testDepsPath);
|
|
33
36
|
expect(needsOptimization('e2e-test-dep-cjs-and-esm', localRequire)).toBe(false);
|
|
34
37
|
expect(needsOptimization('e2e-test-dep-cjs-only', localRequire)).toBe(true);
|
|
35
38
|
expect(needsOptimization('e2e-test-dep-esm-only', localRequire)).toBe(false);
|
package/src/utils/compile.ts
CHANGED
|
@@ -21,7 +21,8 @@ const _createCompileSvelte = (makeHot: Function) =>
|
|
|
21
21
|
const compileOptions: CompileOptions = {
|
|
22
22
|
...options.compilerOptions,
|
|
23
23
|
filename,
|
|
24
|
-
generate: ssr ? 'ssr' : 'dom'
|
|
24
|
+
generate: ssr ? 'ssr' : 'dom',
|
|
25
|
+
format: 'esm'
|
|
25
26
|
};
|
|
26
27
|
if (options.hot && options.emitCss) {
|
|
27
28
|
const hash = `s-${safeBase64Hash(normalizedFilename)}`;
|
package/src/utils/options.ts
CHANGED
|
@@ -61,10 +61,7 @@ export async function preResolveOptions(
|
|
|
61
61
|
};
|
|
62
62
|
const defaultOptions: Partial<Options> = {
|
|
63
63
|
extensions: ['.svelte'],
|
|
64
|
-
emitCss: true
|
|
65
|
-
compilerOptions: {
|
|
66
|
-
format: 'esm'
|
|
67
|
-
}
|
|
64
|
+
emitCss: true
|
|
68
65
|
};
|
|
69
66
|
const svelteConfig = await loadSvelteConfig(viteConfigWithResolvedRoot, inlineOptions);
|
|
70
67
|
const extraOptions: Partial<PreResolvedOptions> = {
|
|
@@ -118,6 +115,7 @@ export function resolveOptions(
|
|
|
118
115
|
};
|
|
119
116
|
const merged: ResolvedOptions = mergeConfigs(defaultOptions, preResolveOptions, extraOptions);
|
|
120
117
|
|
|
118
|
+
removeIgnoredOptions(merged);
|
|
121
119
|
addExtraPreprocessors(merged, viteConfig);
|
|
122
120
|
enforceOptionsForHmr(merged);
|
|
123
121
|
enforceOptionsForProduction(merged);
|
|
@@ -177,6 +175,26 @@ function enforceOptionsForProduction(options: ResolvedOptions) {
|
|
|
177
175
|
}
|
|
178
176
|
}
|
|
179
177
|
|
|
178
|
+
function removeIgnoredOptions(options: ResolvedOptions) {
|
|
179
|
+
const ignoredCompilerOptions = ['generate', 'format', 'filename'];
|
|
180
|
+
if (options.hot && options.emitCss) {
|
|
181
|
+
ignoredCompilerOptions.push('cssHash');
|
|
182
|
+
}
|
|
183
|
+
const passedCompilerOptions = Object.keys(options.compilerOptions || {});
|
|
184
|
+
const passedIgnored = passedCompilerOptions.filter((o) => ignoredCompilerOptions.includes(o));
|
|
185
|
+
if (passedIgnored.length) {
|
|
186
|
+
log.warn(
|
|
187
|
+
`The following Svelte compilerOptions are controlled by vite-plugin-svelte and essential to its functionality. User-specified values are ignored. Please remove them from your configuration: ${passedIgnored.join(
|
|
188
|
+
', '
|
|
189
|
+
)}`
|
|
190
|
+
);
|
|
191
|
+
passedIgnored.forEach((ignored) => {
|
|
192
|
+
// @ts-expect-error string access
|
|
193
|
+
delete options.compilerOptions[ignored];
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
180
198
|
// vite passes unresolved `root`option to config hook but we need the resolved value, so do it here
|
|
181
199
|
// https://github.com/sveltejs/vite-plugin-svelte/issues/113
|
|
182
200
|
// https://github.com/vitejs/vite/blob/43c957de8a99bb326afd732c962f42127b0a4d1e/packages/vite/src/node/config.ts#L293
|
|
@@ -401,11 +419,13 @@ export interface Options {
|
|
|
401
419
|
emitCss?: boolean;
|
|
402
420
|
|
|
403
421
|
/**
|
|
404
|
-
* The options to be passed to the Svelte compiler
|
|
422
|
+
* The options to be passed to the Svelte compiler. A few options are set by default,
|
|
423
|
+
* including `dev` and `css`. However, some options are non-configurable, like
|
|
424
|
+
* `filename`, `format`, `generate`, and `cssHash` (in dev).
|
|
405
425
|
*
|
|
406
426
|
* @see https://svelte.dev/docs#svelte_compile
|
|
407
427
|
*/
|
|
408
|
-
compilerOptions?: CompileOptions
|
|
428
|
+
compilerOptions?: Omit<CompileOptions, 'filename' | 'format' | 'generate'>;
|
|
409
429
|
|
|
410
430
|
/**
|
|
411
431
|
* Handles warning emitted from the Svelte compiler
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="21" height="25" viewBox="0 0 107 128">
|
|
2
|
-
<title>svelte-inspector-logo</title>
|
|
3
|
-
<path d="M94.1566,22.8189c-10.4-14.8851-30.94-19.2971-45.7914-9.8348L22.2825,29.6078A29.9234,29.9234,0,0,0,8.7639,49.6506a31.5136,31.5136,0,0,0,3.1076,20.2318A30.0061,30.0061,0,0,0,7.3953,81.0653a31.8886,31.8886,0,0,0,5.4473,24.1157c10.4022,14.8865,30.9423,19.2966,45.7914,9.8348L84.7167,98.3921A29.9177,29.9177,0,0,0,98.2353,78.3493,31.5263,31.5263,0,0,0,95.13,58.117a30,30,0,0,0,4.4743-11.1824,31.88,31.88,0,0,0-5.4473-24.1157" style="fill:#ff3e00"/><path d="M45.8171,106.5815A20.7182,20.7182,0,0,1,23.58,98.3389a19.1739,19.1739,0,0,1-3.2766-14.5025,18.1886,18.1886,0,0,1,.6233-2.4357l.4912-1.4978,1.3363.9815a33.6443,33.6443,0,0,0,10.203,5.0978l.9694.2941-.0893.9675a5.8474,5.8474,0,0,0,1.052,3.8781,6.2389,6.2389,0,0,0,6.6952,2.485,5.7449,5.7449,0,0,0,1.6021-.7041L69.27,76.281a5.4306,5.4306,0,0,0,2.4506-3.631,5.7948,5.7948,0,0,0-.9875-4.3712,6.2436,6.2436,0,0,0-6.6978-2.4864,5.7427,5.7427,0,0,0-1.6.7036l-9.9532,6.3449a19.0329,19.0329,0,0,1-5.2965,2.3259,20.7181,20.7181,0,0,1-22.2368-8.2427,19.1725,19.1725,0,0,1-3.2766-14.5024,17.9885,17.9885,0,0,1,8.13-12.0513L55.8833,23.7472a19.0038,19.0038,0,0,1,5.3-2.3287A20.7182,20.7182,0,0,1,83.42,29.6611a19.1739,19.1739,0,0,1,3.2766,14.5025,18.4,18.4,0,0,1-.6233,2.4357l-.4912,1.4978-1.3356-.98a33.6175,33.6175,0,0,0-10.2037-5.1l-.9694-.2942.0893-.9675a5.8588,5.8588,0,0,0-1.052-3.878,6.2389,6.2389,0,0,0-6.6952-2.485,5.7449,5.7449,0,0,0-1.6021.7041L37.73,51.719a5.4218,5.4218,0,0,0-2.4487,3.63,5.7862,5.7862,0,0,0,.9856,4.3717,6.2437,6.2437,0,0,0,6.6978,2.4864,5.7652,5.7652,0,0,0,1.602-.7041l9.9519-6.3425a18.978,18.978,0,0,1,5.2959-2.3278,20.7181,20.7181,0,0,1,22.2368,8.2427,19.1725,19.1725,0,0,1,3.2766,14.5024,17.9977,17.9977,0,0,1-8.13,12.0532L51.1167,104.2528a19.0038,19.0038,0,0,1-5.3,2.3287" style="fill:#fff"/>
|
|
4
|
-
<polygon points="0,0 15,40 40,20" stroke="#ff3e00" fill="#ff3e00"></polygon>
|
|
5
|
-
</svg>
|