@tanstack/start-plugin-core 1.161.4 → 1.162.0

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.
Files changed (32) hide show
  1. package/dist/esm/import-protection-plugin/defaults.d.ts +6 -4
  2. package/dist/esm/import-protection-plugin/defaults.js +3 -12
  3. package/dist/esm/import-protection-plugin/defaults.js.map +1 -1
  4. package/dist/esm/import-protection-plugin/plugin.d.ts +1 -1
  5. package/dist/esm/import-protection-plugin/plugin.js +488 -257
  6. package/dist/esm/import-protection-plugin/plugin.js.map +1 -1
  7. package/dist/esm/import-protection-plugin/postCompileUsage.d.ts +4 -2
  8. package/dist/esm/import-protection-plugin/postCompileUsage.js +31 -150
  9. package/dist/esm/import-protection-plugin/postCompileUsage.js.map +1 -1
  10. package/dist/esm/import-protection-plugin/rewriteDeniedImports.js +13 -9
  11. package/dist/esm/import-protection-plugin/rewriteDeniedImports.js.map +1 -1
  12. package/dist/esm/import-protection-plugin/sourceLocation.d.ts +32 -66
  13. package/dist/esm/import-protection-plugin/sourceLocation.js +129 -56
  14. package/dist/esm/import-protection-plugin/sourceLocation.js.map +1 -1
  15. package/dist/esm/import-protection-plugin/trace.d.ts +10 -0
  16. package/dist/esm/import-protection-plugin/trace.js +30 -44
  17. package/dist/esm/import-protection-plugin/trace.js.map +1 -1
  18. package/dist/esm/import-protection-plugin/utils.d.ts +8 -4
  19. package/dist/esm/import-protection-plugin/utils.js +43 -1
  20. package/dist/esm/import-protection-plugin/utils.js.map +1 -1
  21. package/dist/esm/import-protection-plugin/virtualModules.d.ts +7 -1
  22. package/dist/esm/import-protection-plugin/virtualModules.js +104 -135
  23. package/dist/esm/import-protection-plugin/virtualModules.js.map +1 -1
  24. package/package.json +2 -2
  25. package/src/import-protection-plugin/defaults.ts +8 -19
  26. package/src/import-protection-plugin/plugin.ts +776 -433
  27. package/src/import-protection-plugin/postCompileUsage.ts +57 -229
  28. package/src/import-protection-plugin/rewriteDeniedImports.ts +34 -42
  29. package/src/import-protection-plugin/sourceLocation.ts +184 -185
  30. package/src/import-protection-plugin/trace.ts +38 -49
  31. package/src/import-protection-plugin/utils.ts +62 -1
  32. package/src/import-protection-plugin/virtualModules.ts +163 -177
@@ -1,17 +1,19 @@
1
- import { CompileStartFrameworkOptions } from '../types.js';
2
1
  import { ImportProtectionEnvRules } from '../schema.js';
3
2
  export interface DefaultImportProtectionRules {
4
3
  client: Required<ImportProtectionEnvRules>;
5
4
  server: Required<ImportProtectionEnvRules>;
6
5
  }
7
6
  /**
8
- * Returns the default import protection rules for a given framework.
7
+ * Returns the default import protection rules.
8
+ *
9
+ * All three framework variants are always included so that, e.g., a React
10
+ * project also denies `@tanstack/solid-start/server` imports.
9
11
  */
10
- export declare function getDefaultImportProtectionRules(_framework: CompileStartFrameworkOptions): DefaultImportProtectionRules;
12
+ export declare function getDefaultImportProtectionRules(): DefaultImportProtectionRules;
11
13
  /**
12
14
  * Marker module specifiers that restrict a file to a specific environment.
13
15
  */
14
- export declare function getMarkerSpecifiers(_framework: CompileStartFrameworkOptions): {
16
+ export declare function getMarkerSpecifiers(): {
15
17
  serverOnly: Array<string>;
16
18
  clientOnly: Array<string>;
17
19
  };
@@ -1,9 +1,5 @@
1
- function getDefaultImportProtectionRules(_framework) {
2
- const frameworks = [
3
- "react",
4
- "solid",
5
- "vue"
6
- ];
1
+ const frameworks = ["react", "solid", "vue"];
2
+ function getDefaultImportProtectionRules() {
7
3
  const clientSpecifiers = frameworks.map(
8
4
  (fw) => `@tanstack/${fw}-start/server`
9
5
  );
@@ -18,12 +14,7 @@ function getDefaultImportProtectionRules(_framework) {
18
14
  }
19
15
  };
20
16
  }
21
- function getMarkerSpecifiers(_framework) {
22
- const frameworks = [
23
- "react",
24
- "solid",
25
- "vue"
26
- ];
17
+ function getMarkerSpecifiers() {
27
18
  return {
28
19
  serverOnly: frameworks.map((fw) => `@tanstack/${fw}-start/server-only`),
29
20
  clientOnly: frameworks.map((fw) => `@tanstack/${fw}-start/client-only`)
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sources":["../../../src/import-protection-plugin/defaults.ts"],"sourcesContent":["import type { CompileStartFrameworkOptions } from '../types'\nimport type { ImportProtectionEnvRules } from '../schema'\nimport type { Pattern } from './utils'\n\nexport interface DefaultImportProtectionRules {\n client: Required<ImportProtectionEnvRules>\n server: Required<ImportProtectionEnvRules>\n}\n\n/**\n * Returns the default import protection rules for a given framework.\n */\nexport function getDefaultImportProtectionRules(\n _framework: CompileStartFrameworkOptions,\n): DefaultImportProtectionRules {\n const frameworks: Array<CompileStartFrameworkOptions> = [\n 'react',\n 'solid',\n 'vue',\n ]\n\n // Deny client importing server-specific entrypoints\n const clientSpecifiers: Array<Pattern> = frameworks.map(\n (fw) => `@tanstack/${fw}-start/server`,\n )\n\n return {\n client: {\n specifiers: clientSpecifiers,\n files: ['**/*.server.*'],\n },\n server: {\n specifiers: [],\n files: ['**/*.client.*'],\n },\n }\n}\n\n/**\n * Marker module specifiers that restrict a file to a specific environment.\n */\nexport function getMarkerSpecifiers(_framework: CompileStartFrameworkOptions): {\n serverOnly: Array<string>\n clientOnly: Array<string>\n} {\n const frameworks: Array<CompileStartFrameworkOptions> = [\n 'react',\n 'solid',\n 'vue',\n ]\n\n return {\n serverOnly: frameworks.map((fw) => `@tanstack/${fw}-start/server-only`),\n clientOnly: frameworks.map((fw) => `@tanstack/${fw}-start/client-only`),\n }\n}\n"],"names":[],"mappings":"AAYO,SAAS,gCACd,YAC8B;AAC9B,QAAM,aAAkD;AAAA,IACtD;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAIF,QAAM,mBAAmC,WAAW;AAAA,IAClD,CAAC,OAAO,aAAa,EAAE;AAAA,EAAA;AAGzB,SAAO;AAAA,IACL,QAAQ;AAAA,MACN,YAAY;AAAA,MACZ,OAAO,CAAC,eAAe;AAAA,IAAA;AAAA,IAEzB,QAAQ;AAAA,MACN,YAAY,CAAA;AAAA,MACZ,OAAO,CAAC,eAAe;AAAA,IAAA;AAAA,EACzB;AAEJ;AAKO,SAAS,oBAAoB,YAGlC;AACA,QAAM,aAAkD;AAAA,IACtD;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAGF,SAAO;AAAA,IACL,YAAY,WAAW,IAAI,CAAC,OAAO,aAAa,EAAE,oBAAoB;AAAA,IACtE,YAAY,WAAW,IAAI,CAAC,OAAO,aAAa,EAAE,oBAAoB;AAAA,EAAA;AAE1E;"}
1
+ {"version":3,"file":"defaults.js","sources":["../../../src/import-protection-plugin/defaults.ts"],"sourcesContent":["import type { ImportProtectionEnvRules } from '../schema'\nimport type { Pattern } from './utils'\n\nexport interface DefaultImportProtectionRules {\n client: Required<ImportProtectionEnvRules>\n server: Required<ImportProtectionEnvRules>\n}\n\nconst frameworks = ['react', 'solid', 'vue'] as const\n\n/**\n * Returns the default import protection rules.\n *\n * All three framework variants are always included so that, e.g., a React\n * project also denies `@tanstack/solid-start/server` imports.\n */\nexport function getDefaultImportProtectionRules(): DefaultImportProtectionRules {\n const clientSpecifiers: Array<Pattern> = frameworks.map(\n (fw) => `@tanstack/${fw}-start/server`,\n )\n\n return {\n client: {\n specifiers: clientSpecifiers,\n files: ['**/*.server.*'],\n },\n server: {\n specifiers: [],\n files: ['**/*.client.*'],\n },\n }\n}\n\n/**\n * Marker module specifiers that restrict a file to a specific environment.\n */\nexport function getMarkerSpecifiers(): {\n serverOnly: Array<string>\n clientOnly: Array<string>\n} {\n return {\n serverOnly: frameworks.map((fw) => `@tanstack/${fw}-start/server-only`),\n clientOnly: frameworks.map((fw) => `@tanstack/${fw}-start/client-only`),\n }\n}\n"],"names":[],"mappings":"AAQA,MAAM,aAAa,CAAC,SAAS,SAAS,KAAK;AAQpC,SAAS,kCAAgE;AAC9E,QAAM,mBAAmC,WAAW;AAAA,IAClD,CAAC,OAAO,aAAa,EAAE;AAAA,EAAA;AAGzB,SAAO;AAAA,IACL,QAAQ;AAAA,MACN,YAAY;AAAA,MACZ,OAAO,CAAC,eAAe;AAAA,IAAA;AAAA,IAEzB,QAAQ;AAAA,MACN,YAAY,CAAA;AAAA,MACZ,OAAO,CAAC,eAAe;AAAA,IAAA;AAAA,EACzB;AAEJ;AAKO,SAAS,sBAGd;AACA,SAAO;AAAA,IACL,YAAY,WAAW,IAAI,CAAC,OAAO,aAAa,EAAE,oBAAoB;AAAA,IACtE,YAAY,WAAW,IAAI,CAAC,OAAO,aAAa,EAAE,oBAAoB;AAAA,EAAA;AAE1E;"}
@@ -2,7 +2,7 @@ import { PluginOption } from 'vite';
2
2
  import { CompileStartFrameworkOptions, GetConfigFn } from '../types.js';
3
3
  export { RESOLVED_MOCK_MODULE_ID } from './virtualModules.js';
4
4
  export { rewriteDeniedImports } from './rewriteDeniedImports.js';
5
- export { dedupePatterns } from './utils.js';
5
+ export { dedupePatterns, extractImportSources } from './utils.js';
6
6
  export type { Pattern } from './utils.js';
7
7
  export interface ImportProtectionPluginOptions {
8
8
  getConfig: GetConfigFn;