svelte2tsx 0.7.14 → 0.7.16

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/index.d.ts CHANGED
@@ -108,6 +108,10 @@ export interface EmitDtsConfig {
108
108
  * set to `src/lib` by default.
109
109
  */
110
110
  libRoot?: string;
111
+ /**
112
+ * Name of your tsconfig file, if it's not the standard `tsconfig.json` or `jsconfig.json`
113
+ */
114
+ tsconfig?: string;
111
115
  }
112
116
 
113
117
  // to make typo fix non-breaking, continue to export the old name but mark it as deprecated
package/index.js CHANGED
@@ -5310,7 +5310,10 @@ class Scripts {
5310
5310
  // should be 2 at most, one each, so using forEach is safe
5311
5311
  this.topLevelScripts.forEach((tag) => {
5312
5312
  if (tag.attributes &&
5313
- tag.attributes.find((a) => a.name == 'context' && a.value.length == 1 && a.value[0].raw == 'module')) {
5313
+ tag.attributes.find((a) => (a.name == 'context' &&
5314
+ a.value.length == 1 &&
5315
+ a.value[0].raw == 'module') ||
5316
+ a.name === 'module')) {
5314
5317
  moduleScriptTag = tag;
5315
5318
  }
5316
5319
  else {
@@ -6404,7 +6407,7 @@ function addSimpleComponentExport({ strictEvents, isTsFile, canHaveAnyProp, expo
6404
6407
  statement =
6405
6408
  `\ninterface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
6406
6409
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & { $$bindings?: Bindings } & Exports;
6407
- (internal: unknown, props: ${!canHaveAnyProp && exportedNames.hasNoProps() ? '{$$events?: Events, $$slots?: Slots}' : 'Props & {$$events?: Events, $$slots?: Slots}'}): Exports;
6410
+ (internal: unknown, props: ${!canHaveAnyProp && exportedNames.hasNoProps() ? '{$$events?: Events, $$slots?: Slots}' : 'Props & {$$events?: Events, $$slots?: Slots}'}): Exports & { $set?: any, $on?: any };
6408
6411
  z_$$bindings?: Bindings;
6409
6412
  }\n` +
6410
6413
  (usesSlots
@@ -6993,7 +6996,7 @@ function loadTsconfig(config, svelteMap) {
6993
6996
  var _a;
6994
6997
  const libRoot = config.libRoot || process.cwd();
6995
6998
  const jsconfigFile = ts.findConfigFile(libRoot, ts.sys.fileExists, 'jsconfig.json');
6996
- let tsconfigFile = ts.findConfigFile(libRoot, ts.sys.fileExists);
6999
+ let tsconfigFile = ts.findConfigFile(libRoot, ts.sys.fileExists, config.tsconfig);
6997
7000
  if (!tsconfigFile && !jsconfigFile) {
6998
7001
  throw new Error('Failed to locate tsconfig or jsconfig');
6999
7002
  }
package/index.mjs CHANGED
@@ -5290,7 +5290,10 @@ class Scripts {
5290
5290
  // should be 2 at most, one each, so using forEach is safe
5291
5291
  this.topLevelScripts.forEach((tag) => {
5292
5292
  if (tag.attributes &&
5293
- tag.attributes.find((a) => a.name == 'context' && a.value.length == 1 && a.value[0].raw == 'module')) {
5293
+ tag.attributes.find((a) => (a.name == 'context' &&
5294
+ a.value.length == 1 &&
5295
+ a.value[0].raw == 'module') ||
5296
+ a.name === 'module')) {
5294
5297
  moduleScriptTag = tag;
5295
5298
  }
5296
5299
  else {
@@ -6384,7 +6387,7 @@ function addSimpleComponentExport({ strictEvents, isTsFile, canHaveAnyProp, expo
6384
6387
  statement =
6385
6388
  `\ninterface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
6386
6389
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & { $$bindings?: Bindings } & Exports;
6387
- (internal: unknown, props: ${!canHaveAnyProp && exportedNames.hasNoProps() ? '{$$events?: Events, $$slots?: Slots}' : 'Props & {$$events?: Events, $$slots?: Slots}'}): Exports;
6390
+ (internal: unknown, props: ${!canHaveAnyProp && exportedNames.hasNoProps() ? '{$$events?: Events, $$slots?: Slots}' : 'Props & {$$events?: Events, $$slots?: Slots}'}): Exports & { $set?: any, $on?: any };
6388
6391
  z_$$bindings?: Bindings;
6389
6392
  }\n` +
6390
6393
  (usesSlots
@@ -6973,7 +6976,7 @@ function loadTsconfig(config, svelteMap) {
6973
6976
  var _a;
6974
6977
  const libRoot = config.libRoot || process.cwd();
6975
6978
  const jsconfigFile = ts.findConfigFile(libRoot, ts.sys.fileExists, 'jsconfig.json');
6976
- let tsconfigFile = ts.findConfigFile(libRoot, ts.sys.fileExists);
6979
+ let tsconfigFile = ts.findConfigFile(libRoot, ts.sys.fileExists, config.tsconfig);
6977
6980
  if (!tsconfigFile && !jsconfigFile) {
6978
6981
  throw new Error('Failed to locate tsconfig or jsconfig');
6979
6982
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte2tsx",
3
- "version": "0.7.14",
3
+ "version": "0.7.16",
4
4
  "description": "Convert Svelte components to TSX for type checking",
5
5
  "author": "David Pershouse",
6
6
  "license": "MIT",
@@ -243,7 +243,7 @@ declare function __sveltets_$$bindings<Bindings extends string[]>(...bindings: B
243
243
 
244
244
  interface __sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
245
245
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & { $$bindings?: Bindings } & Exports;
246
- (internal: unknown, props: Props extends Record<string, never> ? {$$events?: Events, $$slots?: Slots} : Props & {$$events?: Events, $$slots?: Slots}): Exports;
246
+ (internal: unknown, props: Props extends Record<string, never> ? {$$events?: Events, $$slots?: Slots} : Props & {$$events?: Events, $$slots?: Slots}): Exports & { $set?: any, $on?: any };
247
247
  z_$$bindings?: Bindings;
248
248
  }
249
249