@sveltejs/kit 1.0.0-next.378 → 1.0.0-next.379

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.
@@ -126,6 +126,8 @@ class LoadURL extends URL {
126
126
  }
127
127
  }
128
128
 
129
+ /* global __SVELTEKIT_APP_VERSION__, __SVELTEKIT_APP_VERSION_FILE__, __SVELTEKIT_APP_VERSION_POLL_INTERVAL__ */
130
+
129
131
  /** @param {HTMLDocument} doc */
130
132
  function get_base_uri(doc) {
131
133
  let baseURI = doc.baseURI;
@@ -193,10 +195,7 @@ function notifiable_store(value) {
193
195
  function create_updated_store() {
194
196
  const { set, subscribe } = writable(false);
195
197
 
196
- const interval = +(
197
- /** @type {string} */ (import.meta.env.VITE_SVELTEKIT_APP_VERSION_POLL_INTERVAL)
198
- );
199
- const initial = import.meta.env.VITE_SVELTEKIT_APP_VERSION;
198
+ const interval = __SVELTEKIT_APP_VERSION_POLL_INTERVAL__;
200
199
 
201
200
  /** @type {NodeJS.Timeout} */
202
201
  let timeout;
@@ -208,9 +207,7 @@ function create_updated_store() {
208
207
 
209
208
  if (interval) timeout = setTimeout(check, interval);
210
209
 
211
- const file = import.meta.env.VITE_SVELTEKIT_APP_VERSION_FILE;
212
-
213
- const res = await fetch(`${assets}/${file}`, {
210
+ const res = await fetch(`${assets}/${__SVELTEKIT_APP_VERSION_FILE__}`, {
214
211
  headers: {
215
212
  pragma: 'no-cache',
216
213
  'cache-control': 'no-cache'
@@ -219,7 +216,7 @@ function create_updated_store() {
219
216
 
220
217
  if (res.ok) {
221
218
  const { version } = await res.json();
222
- const updated = version !== initial;
219
+ const updated = version !== __SVELTEKIT_APP_VERSION__;
223
220
 
224
221
  if (updated) {
225
222
  set(true);
@@ -165,8 +165,6 @@ function clone_error(error, get_stack) {
165
165
  const {
166
166
  name,
167
167
  message,
168
- // this should constitute 'using' a var, since it affects `custom`
169
- // eslint-disable-next-line
170
168
  stack,
171
169
  // @ts-expect-error i guess typescript doesn't know about error.cause yet
172
170
  cause,
@@ -3214,6 +3212,8 @@ function exec(match, names, types, matchers) {
3214
3212
  return params;
3215
3213
  }
3216
3214
 
3215
+ /* global __SVELTEKIT_ADAPTER_NAME__ */
3216
+
3217
3217
  const DATA_SUFFIX = '/__data.json';
3218
3218
 
3219
3219
  /** @param {{ html: string }} opts */
@@ -3321,9 +3321,7 @@ async function respond(request, options, state) {
3321
3321
  get clientAddress() {
3322
3322
  if (!state.getClientAddress) {
3323
3323
  throw new Error(
3324
- `${
3325
- import.meta.env.VITE_SVELTEKIT_ADAPTER_NAME
3326
- } does not specify getClientAddress. Please raise an issue`
3324
+ `${__SVELTEKIT_ADAPTER_NAME__} does not specify getClientAddress. Please raise an issue`
3327
3325
  );
3328
3326
  }
3329
3327
 
@@ -564,7 +564,6 @@ function trace(file, path, tree, extensions) {
564
564
 
565
565
  // walk up the tree, find which __layout and __error components
566
566
  // apply to this page
567
- // eslint-disable-next-line
568
567
  while (true) {
569
568
  const node = tree.get(parts.join('/'));
570
569
  const layout = node?.layouts[layout_id];
@@ -726,7 +725,7 @@ function copy_assets(dest) {
726
725
  }
727
726
 
728
727
  prefix = `../${prefix}`;
729
- } while (true); // eslint-disable-line
728
+ } while (true);
730
729
  }
731
730
 
732
731
  const s = JSON.stringify;
package/dist/cli.js CHANGED
@@ -18,7 +18,7 @@ function handle_error(e) {
18
18
  process.exit(1);
19
19
  }
20
20
 
21
- const prog = sade('svelte-kit').version('1.0.0-next.378');
21
+ const prog = sade('svelte-kit').version('1.0.0-next.379');
22
22
 
23
23
  prog
24
24
  .command('package')
package/dist/vite.js CHANGED
@@ -273,6 +273,12 @@ const get_default_config = function ({ config, input, ssr, outDir }) {
273
273
  ssr,
274
274
  target: ssr ? 'node14.8' : undefined
275
275
  },
276
+ define: {
277
+ __SVELTEKIT_ADAPTER_NAME__: JSON.stringify(config.kit.adapter?.name),
278
+ __SVELTEKIT_APP_VERSION__: JSON.stringify(config.kit.version.name),
279
+ __SVELTEKIT_APP_VERSION_FILE__: JSON.stringify(`${config.kit.appDir}/version.json`),
280
+ __SVELTEKIT_APP_VERSION_POLL_INTERVAL__: JSON.stringify(config.kit.version.pollInterval)
281
+ },
276
282
  // prevent Vite copying the contents of `config.kit.files.assets`,
277
283
  // if it happens to be 'public' instead of 'static'
278
284
  publicDir: false,
@@ -510,8 +516,6 @@ async function build_server(options, client) {
510
516
 
511
517
  remove_svelte_kit(merged_config);
512
518
 
513
- process.env.VITE_SVELTEKIT_ADAPTER_NAME = config.kit.adapter?.name;
514
-
515
519
  const { chunks } = await create_build(merged_config);
516
520
 
517
521
  /** @type {import('vite').Manifest} */
@@ -2053,8 +2057,6 @@ async function dev(vite, vite_config, svelte_config) {
2053
2057
 
2054
2058
  const runtime = get_runtime_prefix(svelte_config.kit);
2055
2059
 
2056
- process.env.VITE_SVELTEKIT_APP_VERSION_POLL_INTERVAL = '0';
2057
-
2058
2060
  /** @type {import('types').Respond} */
2059
2061
  const respond = (await import(`${runtime}/server/index.js`)).respond;
2060
2062
 
@@ -2875,7 +2877,7 @@ function kit() {
2875
2877
 
2876
2878
  let completed_build = false;
2877
2879
 
2878
- function vite_client_config() {
2880
+ function vite_client_build_config() {
2879
2881
  /** @type {Record<string, string>} */
2880
2882
  const input = {
2881
2883
  // Put unchanging assets in immutable directory. We don't set that in the
@@ -2948,13 +2950,9 @@ function kit() {
2948
2950
  };
2949
2951
 
2950
2952
  if (is_build) {
2951
- process.env.VITE_SVELTEKIT_APP_VERSION = svelte_config.kit.version.name;
2952
- process.env.VITE_SVELTEKIT_APP_VERSION_FILE = `${svelte_config.kit.appDir}/version.json`;
2953
- process.env.VITE_SVELTEKIT_APP_VERSION_POLL_INTERVAL = `${svelte_config.kit.version.pollInterval}`;
2954
-
2955
2953
  manifest_data = all(svelte_config).manifest_data;
2956
2954
 
2957
- const new_config = vite_client_config();
2955
+ const new_config = vite_client_build_config();
2958
2956
 
2959
2957
  warn_overridden_config(config, new_config);
2960
2958
 
@@ -2973,6 +2971,9 @@ function kit() {
2973
2971
  input: `${get_runtime_directory(svelte_config.kit)}/client/start.js`
2974
2972
  }
2975
2973
  },
2974
+ define: {
2975
+ __SVELTEKIT_APP_VERSION_POLL_INTERVAL__: '0'
2976
+ },
2976
2977
  resolve: {
2977
2978
  alias: get_aliases(svelte_config.kit)
2978
2979
  },
@@ -3037,7 +3038,7 @@ function kit() {
3037
3038
 
3038
3039
  fs__default.writeFileSync(
3039
3040
  `${paths.client_out_dir}/version.json`,
3040
- JSON.stringify({ version: process.env.VITE_SVELTEKIT_APP_VERSION })
3041
+ JSON.stringify({ version: svelte_config.kit.version.name })
3041
3042
  );
3042
3043
 
3043
3044
  const { assets, chunks } = collect_output(bundle);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.378",
3
+ "version": "1.0.0-next.379",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -27,7 +27,6 @@
27
27
  "cookie": "^0.5.0",
28
28
  "cross-env": "^7.0.3",
29
29
  "devalue": "^2.0.1",
30
- "eslint": "^8.16.0",
31
30
  "kleur": "^4.1.4",
32
31
  "locate-character": "^2.0.5",
33
32
  "marked": "^4.0.16",
@@ -85,11 +84,10 @@
85
84
  "scripts": {
86
85
  "build": "rollup -c && node scripts/cp.js src/runtime/components assets/components && npm run types",
87
86
  "dev": "rollup -cw",
88
- "lint": "eslint --ignore-path .gitignore --ignore-pattern \"src/packaging/test/**\" \"{src,test}/**/*.{ts,mjs,js,svelte}\" && npm run check-format",
87
+ "lint": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
89
88
  "check": "tsc",
90
89
  "check:all": "tsc && pnpm -r --filter=\"./**\" check",
91
90
  "format": "npm run check-format -- --write",
92
- "check-format": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
93
91
  "test": "npm run test:unit && npm run test:typings && npm run test:packaging && npm run test:integration",
94
92
  "test:integration": "pnpm run -r --workspace-concurrency 1 --filter=\"./test/**\" test",
95
93
  "test:unit": "uvu src \"(spec\\.js|test[\\\\/]index\\.js)\" -i packaging",
@@ -317,3 +317,10 @@ export type ValidatedKitConfig = RecursiveRequired<KitConfig>;
317
317
 
318
318
  export * from './index';
319
319
  export * from './private';
320
+
321
+ declare global {
322
+ const __SVELTEKIT_ADAPTER_NAME__: string;
323
+ const __SVELTEKIT_APP_VERSION__: string;
324
+ const __SVELTEKIT_APP_VERSION_FILE__: string;
325
+ const __SVELTEKIT_APP_VERSION_POLL_INTERVAL__: number;
326
+ }