@sveltejs/kit 1.0.0-next.240 → 1.0.0-next.241

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.
@@ -1,7 +1,7 @@
1
1
  import * as fs from 'fs';
2
2
  import * as path from 'path';
3
3
  import { createRequire } from 'module';
4
- import { h as rimraf, w as walk$1, $, m as mkdirp } from '../cli.js';
4
+ import { h as rimraf, m as mkdirp, w as walk$1, $ } from '../cli.js';
5
5
  import 'sade';
6
6
  import 'child_process';
7
7
  import 'net';
@@ -15257,6 +15257,7 @@ async function make_package(config, cwd = process.cwd()) {
15257
15257
  const package_dir = config.kit.package.dir;
15258
15258
  const abs_package_dir = path.isAbsolute(package_dir) ? package_dir : path.join(cwd, package_dir);
15259
15259
  rimraf(abs_package_dir);
15260
+ mkdirp(abs_package_dir); // TODO https://github.com/sveltejs/kit/issues/2333
15260
15261
 
15261
15262
  if (config.kit.package.emitTypes) {
15262
15263
  // Generate type definitions first so hand-written types can overwrite generated ones
@@ -15304,25 +15305,28 @@ async function make_package(config, cwd = process.cwd()) {
15304
15305
  }
15305
15306
 
15306
15307
  const filename = path.join(config.kit.files.lib, file);
15307
- const source = fs.readFileSync(filename, 'utf8');
15308
+ const source = fs.readFileSync(filename);
15308
15309
 
15309
15310
  /** @type {string} */
15310
15311
  let out_file;
15311
15312
 
15312
- /** @type {string} */
15313
+ /** @type {string | Buffer} */
15313
15314
  let out_contents;
15314
15315
 
15315
15316
  if (svelte_ext) {
15316
15317
  // it's a Svelte component
15318
+ contains_svelte_files = true;
15317
15319
  out_file = file.slice(0, -svelte_ext.length) + '.svelte';
15320
+ out_contents = source.toString('utf-8');
15318
15321
  out_contents = config.preprocess
15319
- ? strip_lang_tags((await preprocess(source, config.preprocess, { filename })).code)
15320
- : source;
15321
- contains_svelte_files = true;
15322
+ ? strip_lang_tags((await preprocess(out_contents, config.preprocess, { filename })).code)
15323
+ : out_contents;
15324
+ out_contents = resolve_$lib_alias(out_file, out_contents, config);
15322
15325
  } else if (ext === '.ts' && file.endsWith('.d.ts')) {
15323
15326
  // TypeScript's declaration emit won't copy over the d.ts files, so we do it here
15324
15327
  out_file = file;
15325
- out_contents = source;
15328
+ out_contents = source.toString('utf-8');
15329
+ out_contents = resolve_$lib_alias(out_file, out_contents, config);
15326
15330
  if (fs.existsSync(path.join(abs_package_dir, out_file))) {
15327
15331
  console.warn(
15328
15332
  'Found already existing file from d.ts generation for ' +
@@ -15332,12 +15336,12 @@ async function make_package(config, cwd = process.cwd()) {
15332
15336
  }
15333
15337
  } else if (ext === '.ts') {
15334
15338
  out_file = file.slice(0, -'.ts'.length) + '.js';
15335
- out_contents = await transpile_ts(filename, source);
15339
+ out_contents = await transpile_ts(filename, source.toString('utf-8'));
15340
+ out_contents = resolve_$lib_alias(out_file, out_contents, config);
15336
15341
  } else {
15337
15342
  out_file = file;
15338
15343
  out_contents = source;
15339
15344
  }
15340
- out_contents = resolve_$lib_alias(out_file, out_contents, config);
15341
15345
 
15342
15346
  write(path.join(abs_package_dir, out_file), out_contents);
15343
15347
 
@@ -15529,7 +15533,7 @@ function load_tsconfig(filename, ts) {
15529
15533
 
15530
15534
  /**
15531
15535
  * @param {string} file
15532
- * @param {string} contents
15536
+ * @param {Parameters<typeof fs.writeFileSync>[1]} contents
15533
15537
  */
15534
15538
  function write(file, contents) {
15535
15539
  mkdirp(path.dirname(file));
package/dist/cli.js CHANGED
@@ -933,7 +933,7 @@ async function launch(port, https) {
933
933
  exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
934
934
  }
935
935
 
936
- const prog = sade('svelte-kit').version('1.0.0-next.240');
936
+ const prog = sade('svelte-kit').version('1.0.0-next.241');
937
937
 
938
938
  prog
939
939
  .command('dev')
@@ -1085,7 +1085,7 @@ async function check_port(port) {
1085
1085
  function welcome({ port, host, https, open, loose, allow, cwd }) {
1086
1086
  if (open) launch(port, https);
1087
1087
 
1088
- console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.240'}\n`));
1088
+ console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.241'}\n`));
1089
1089
 
1090
1090
  const protocol = https ? 'https:' : 'http:';
1091
1091
  const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.240",
3
+ "version": "1.0.0-next.241",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",