@ryanatkn/gro 0.143.3 → 0.144.1

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 (61) hide show
  1. package/dist/esbuild_plugin_external_worker.d.ts +2 -2
  2. package/dist/esbuild_plugin_external_worker.d.ts.map +1 -1
  3. package/dist/esbuild_plugin_svelte.d.ts +2 -2
  4. package/dist/esbuild_plugin_svelte.d.ts.map +1 -1
  5. package/dist/esbuild_plugin_sveltekit_shim_alias.d.ts +2 -2
  6. package/dist/esbuild_plugin_sveltekit_shim_alias.d.ts.map +1 -1
  7. package/dist/esbuild_plugin_sveltekit_shim_app.d.ts +2 -2
  8. package/dist/esbuild_plugin_sveltekit_shim_app.d.ts.map +1 -1
  9. package/dist/esbuild_plugin_sveltekit_shim_env.d.ts +2 -2
  10. package/dist/esbuild_plugin_sveltekit_shim_env.d.ts.map +1 -1
  11. package/dist/filer.d.ts +3 -3
  12. package/dist/filer.d.ts.map +1 -1
  13. package/dist/filer.js +0 -2
  14. package/dist/gro.config.default.js +5 -5
  15. package/dist/gro_plugin_gen.d.ts +2 -2
  16. package/dist/gro_plugin_gen.d.ts.map +1 -1
  17. package/dist/gro_plugin_moss.d.ts +22 -0
  18. package/dist/gro_plugin_moss.d.ts.map +1 -0
  19. package/dist/gro_plugin_moss.js +100 -0
  20. package/dist/gro_plugin_server.d.ts +2 -2
  21. package/dist/gro_plugin_server.d.ts.map +1 -1
  22. package/dist/gro_plugin_sveltekit_app.d.ts +2 -2
  23. package/dist/gro_plugin_sveltekit_app.d.ts.map +1 -1
  24. package/dist/gro_plugin_sveltekit_library.d.ts +2 -2
  25. package/dist/gro_plugin_sveltekit_library.d.ts.map +1 -1
  26. package/dist/moss_helpers.d.ts +1 -1
  27. package/dist/moss_helpers.d.ts.map +1 -1
  28. package/dist/moss_helpers.js +3 -3
  29. package/dist/package.d.ts +17 -0
  30. package/dist/package.d.ts.map +1 -1
  31. package/dist/package.js +36 -20
  32. package/dist/package_json.d.ts +6 -4
  33. package/dist/package_json.d.ts.map +1 -1
  34. package/dist/package_json.js +12 -12
  35. package/dist/resolve_node_specifier.d.ts +2 -5
  36. package/dist/resolve_node_specifier.d.ts.map +1 -1
  37. package/dist/resolve_node_specifier.js +233 -44
  38. package/dist/sveltekit_helpers.d.ts +1 -1
  39. package/dist/sveltekit_helpers.d.ts.map +1 -1
  40. package/dist/sveltekit_helpers.js +2 -2
  41. package/dist/watch_dir.d.ts +2 -2
  42. package/dist/watch_dir.d.ts.map +1 -1
  43. package/package.json +12 -8
  44. package/src/lib/esbuild_plugin_external_worker.ts +2 -2
  45. package/src/lib/esbuild_plugin_svelte.ts +2 -2
  46. package/src/lib/esbuild_plugin_sveltekit_shim_alias.ts +2 -2
  47. package/src/lib/esbuild_plugin_sveltekit_shim_app.ts +2 -2
  48. package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +2 -2
  49. package/src/lib/filer.ts +3 -6
  50. package/src/lib/gro.config.default.ts +5 -5
  51. package/src/lib/gro_plugin_gen.ts +2 -2
  52. package/src/lib/gro_plugin_moss.ts +140 -0
  53. package/src/lib/gro_plugin_server.ts +2 -2
  54. package/src/lib/gro_plugin_sveltekit_app.ts +2 -2
  55. package/src/lib/gro_plugin_sveltekit_library.ts +2 -2
  56. package/src/lib/moss_helpers.ts +2 -3
  57. package/src/lib/package.ts +36 -20
  58. package/src/lib/package_json.ts +15 -14
  59. package/src/lib/resolve_node_specifier.ts +267 -49
  60. package/src/lib/sveltekit_helpers.ts +1 -2
  61. package/src/lib/watch_dir.ts +2 -2
package/dist/package.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // generated by src/lib/package.gen.ts
2
2
  export const package_json = {
3
3
  name: '@ryanatkn/gro',
4
- version: '0.143.3',
4
+ version: '0.144.1',
5
5
  description: 'task runner and toolkit extending SvelteKit',
6
6
  motto: 'generate, run, optimize',
7
7
  glyph: '🌰',
@@ -39,11 +39,11 @@ export const package_json = {
39
39
  'typescript',
40
40
  ],
41
41
  dependencies: {
42
- '@ryanatkn/belt': '^0.25.3',
42
+ '@ryanatkn/belt': '^0.26.0',
43
43
  chokidar: '^4.0.1',
44
44
  dotenv: '^16.4.5',
45
45
  'es-module-lexer': '^1.5.4',
46
- 'esm-env': '^1.0.0',
46
+ 'esm-env': '^1.1.4',
47
47
  mri: '^1.2.0',
48
48
  prettier: '^3.3.3',
49
49
  'prettier-plugin-svelte': '^3.2.7',
@@ -56,21 +56,21 @@ export const package_json = {
56
56
  '@changesets/changelog-git': '^0.2.0',
57
57
  '@changesets/types': '^6.0.0',
58
58
  '@ryanatkn/eslint-config': '^0.5.5',
59
- '@ryanatkn/fuz': '^0.130.1',
60
- '@ryanatkn/moss': '^0.18.2',
59
+ '@ryanatkn/fuz': '^0.130.3',
60
+ '@ryanatkn/moss': '^0.19.0',
61
61
  '@sveltejs/adapter-static': '^3.0.6',
62
62
  '@sveltejs/kit': '^2.7.3',
63
63
  '@sveltejs/package': '^2.3.7',
64
64
  '@sveltejs/vite-plugin-svelte': '^4.0.0',
65
65
  '@types/fs-extra': '^11.0.4',
66
- '@types/node': '^22.8.1',
66
+ '@types/node': '^22.8.4',
67
67
  esbuild: '^0.21.5',
68
68
  eslint: '^9.13.0',
69
69
  'eslint-plugin-svelte': '^2.46.0',
70
- svelte: '^5.1.3',
70
+ svelte: '^5.1.5',
71
71
  'svelte-check': '^4.0.5',
72
72
  typescript: '^5.6.3',
73
- 'typescript-eslint': '^8.11.0',
73
+ 'typescript-eslint': '^8.12.1',
74
74
  uvu: '^0.5.6',
75
75
  },
76
76
  prettier: {
@@ -152,6 +152,10 @@ export const package_json = {
152
152
  types: './dist/gro_plugin_gen.d.ts',
153
153
  default: './dist/gro_plugin_gen.js',
154
154
  },
155
+ './gro_plugin_moss.js': {
156
+ types: './dist/gro_plugin_moss.d.ts',
157
+ default: './dist/gro_plugin_moss.js',
158
+ },
155
159
  './gro_plugin_server.js': {
156
160
  types: './dist/gro_plugin_server.d.ts',
157
161
  default: './dist/gro_plugin_server.js',
@@ -261,7 +265,7 @@ export const package_json = {
261
265
  };
262
266
  export const src_json = {
263
267
  name: '@ryanatkn/gro',
264
- version: '0.143.3',
268
+ version: '0.144.1',
265
269
  modules: {
266
270
  '.': {
267
271
  path: 'index.ts',
@@ -425,14 +429,14 @@ export const src_json = {
425
429
  './esbuild_plugin_external_worker.js': {
426
430
  path: 'esbuild_plugin_external_worker.ts',
427
431
  declarations: [
428
- { name: 'Options', kind: 'type' },
432
+ { name: 'Esbuild_Plugin_External_Worker_Options', kind: 'type' },
429
433
  { name: 'esbuild_plugin_external_worker', kind: 'function' },
430
434
  ],
431
435
  },
432
436
  './esbuild_plugin_svelte.js': {
433
437
  path: 'esbuild_plugin_svelte.ts',
434
438
  declarations: [
435
- { name: 'Options', kind: 'type' },
439
+ { name: 'Esbuild_Plugin_Svelte_Options', kind: 'type' },
436
440
  { name: 'esbuild_plugin_svelte', kind: 'function' },
437
441
  ],
438
442
  },
@@ -443,21 +447,21 @@ export const src_json = {
443
447
  './esbuild_plugin_sveltekit_shim_alias.js': {
444
448
  path: 'esbuild_plugin_sveltekit_shim_alias.ts',
445
449
  declarations: [
446
- { name: 'Options', kind: 'type' },
450
+ { name: 'Esbuild_Plugin_Sveltekit_Shim_Alias_Options', kind: 'type' },
447
451
  { name: 'esbuild_plugin_sveltekit_shim_alias', kind: 'function' },
448
452
  ],
449
453
  },
450
454
  './esbuild_plugin_sveltekit_shim_app.js': {
451
455
  path: 'esbuild_plugin_sveltekit_shim_app.ts',
452
456
  declarations: [
453
- { name: 'Options', kind: 'type' },
457
+ { name: 'Esbuild_Plugin_Sveltekit_Shim_App_Options', kind: 'type' },
454
458
  { name: 'esbuild_plugin_sveltekit_shim_app', kind: 'function' },
455
459
  ],
456
460
  },
457
461
  './esbuild_plugin_sveltekit_shim_env.js': {
458
462
  path: 'esbuild_plugin_sveltekit_shim_env.ts',
459
463
  declarations: [
460
- { name: 'Options', kind: 'type' },
464
+ { name: 'Esbuild_Plugin_Sveltekit_Shim_Env_Options', kind: 'type' },
461
465
  { name: 'esbuild_plugin_sveltekit_shim_env', kind: 'function' },
462
466
  ],
463
467
  },
@@ -467,7 +471,7 @@ export const src_json = {
467
471
  { name: 'Source_File', kind: 'type' },
468
472
  { name: 'Cleanup_Watch', kind: 'type' },
469
473
  { name: 'On_Filer_Change', kind: 'type' },
470
- { name: 'Options', kind: 'type' },
474
+ { name: 'Filer_Options', kind: 'type' },
471
475
  { name: 'Filer', kind: 'class' },
472
476
  ],
473
477
  },
@@ -588,17 +592,28 @@ export const src_json = {
588
592
  path: 'gro_plugin_gen.ts',
589
593
  declarations: [
590
594
  { name: 'Task_Args', kind: 'type' },
591
- { name: 'Options', kind: 'type' },
595
+ { name: 'Gro_Plugin_Gen_Options', kind: 'type' },
592
596
  { name: 'gro_plugin_gen', kind: 'function' },
593
597
  { name: 'filter_dependents', kind: 'function' },
594
598
  ],
595
599
  },
600
+ './gro_plugin_moss.js': {
601
+ path: 'gro_plugin_moss.ts',
602
+ declarations: [
603
+ { name: 'MOSS_PACKAGE_DEP_NAME', kind: 'variable' },
604
+ { name: 'has_moss_dep', kind: 'function' },
605
+ { name: 'generate_classes_css', kind: 'function' },
606
+ { name: 'Task_Args', kind: 'type' },
607
+ { name: 'Options', kind: 'type' },
608
+ { name: 'gro_plugin_moss', kind: 'function' },
609
+ ],
610
+ },
596
611
  './gro_plugin_server.js': {
597
612
  path: 'gro_plugin_server.ts',
598
613
  declarations: [
599
614
  { name: 'SERVER_SOURCE_ID', kind: 'variable' },
600
615
  { name: 'has_server', kind: 'function' },
601
- { name: 'Options', kind: 'type' },
616
+ { name: 'Gro_Plugin_Server_Options', kind: 'type' },
602
617
  { name: 'Outpaths', kind: 'type' },
603
618
  { name: 'Create_Outpaths', kind: 'type' },
604
619
  { name: 'gro_plugin_server', kind: 'function' },
@@ -607,7 +622,7 @@ export const src_json = {
607
622
  './gro_plugin_sveltekit_app.js': {
608
623
  path: 'gro_plugin_sveltekit_app.ts',
609
624
  declarations: [
610
- { name: 'Options', kind: 'type' },
625
+ { name: 'Gro_Plugin_Sveltekit_App_Options', kind: 'type' },
611
626
  { name: 'Host_Target', kind: 'type' },
612
627
  { name: 'Copy_File_Filter', kind: 'type' },
613
628
  { name: 'gro_plugin_sveltekit_app', kind: 'function' },
@@ -616,7 +631,7 @@ export const src_json = {
616
631
  './gro_plugin_sveltekit_library.js': {
617
632
  path: 'gro_plugin_sveltekit_library.ts',
618
633
  declarations: [
619
- { name: 'Options', kind: 'type' },
634
+ { name: 'Gro_Plugin_Sveltekit_Library_Options', kind: 'type' },
620
635
  { name: 'gro_plugin_sveltekit_library', kind: 'function' },
621
636
  ],
622
637
  },
@@ -698,6 +713,7 @@ export const src_json = {
698
713
  { name: 'Package_Json_Repository', kind: 'variable' },
699
714
  { name: 'Package_Json_Author', kind: 'variable' },
700
715
  { name: 'Package_Json_Funding', kind: 'variable' },
716
+ { name: 'Export_Value', kind: 'variable' },
701
717
  { name: 'Package_Json_Exports', kind: 'variable' },
702
718
  { name: 'Package_Json', kind: 'variable' },
703
719
  { name: 'Map_Package_Json', kind: 'type' },
@@ -1031,7 +1047,7 @@ export const src_json = {
1031
1047
  { name: 'Watcher_Change', kind: 'type' },
1032
1048
  { name: 'Watcher_Change_Type', kind: 'type' },
1033
1049
  { name: 'Watcher_Change_Callback', kind: 'type' },
1034
- { name: 'Options', kind: 'type' },
1050
+ { name: 'Watch_Dir_Options', kind: 'type' },
1035
1051
  { name: 'watch_dir', kind: 'function' },
1036
1052
  ],
1037
1053
  },
@@ -45,7 +45,9 @@ export declare const Package_Json_Funding: z.ZodUnion<[z.ZodString, z.ZodObject<
45
45
  url: z.ZodString;
46
46
  }, z.ZodTypeAny, "passthrough">>]>;
47
47
  export type Package_Json_Funding = z.infer<typeof Package_Json_Funding>;
48
- export declare const Package_Json_Exports: z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>>]>>>;
48
+ export declare const Export_Value: z.ZodType<any, z.ZodTypeDef, any>;
49
+ export type Export_Value = z.infer<typeof Export_Value>;
50
+ export declare const Package_Json_Exports: z.ZodUnion<[z.ZodString, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodType<any, z.ZodTypeDef, any>>]>;
49
51
  export type Package_Json_Exports = z.infer<typeof Package_Json_Exports>;
50
52
  /**
51
53
  * @see https://docs.npmjs.com/cli/v10/configuring-npm/package-json
@@ -151,7 +153,7 @@ export declare const Package_Json: z.ZodObject<{
151
153
  sideEffects: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
152
154
  files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
153
155
  main: z.ZodOptional<z.ZodString>;
154
- exports: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>>]>>>, Record<string, string | Record<string, string | undefined> | Record<string, Record<string, string | undefined> | undefined> | undefined> | undefined, Record<string, string | Record<string, string | undefined> | Record<string, Record<string, string | undefined> | undefined> | undefined>>>;
156
+ exports: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodType<any, z.ZodTypeDef, any>>]>, string | Record<string, any> | null | undefined, string | Record<string, any> | null>>;
155
157
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
156
158
  name: z.ZodString;
157
159
  version: z.ZodString;
@@ -253,7 +255,7 @@ export declare const Package_Json: z.ZodObject<{
253
255
  sideEffects: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
254
256
  files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
255
257
  main: z.ZodOptional<z.ZodString>;
256
- exports: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>>]>>>, Record<string, string | Record<string, string | undefined> | Record<string, Record<string, string | undefined> | undefined> | undefined> | undefined, Record<string, string | Record<string, string | undefined> | Record<string, Record<string, string | undefined> | undefined> | undefined>>>;
258
+ exports: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodType<any, z.ZodTypeDef, any>>]>, string | Record<string, any> | null | undefined, string | Record<string, any> | null>>;
257
259
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
258
260
  name: z.ZodString;
259
261
  version: z.ZodString;
@@ -355,7 +357,7 @@ export declare const Package_Json: z.ZodObject<{
355
357
  sideEffects: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
356
358
  files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
357
359
  main: z.ZodOptional<z.ZodString>;
358
- exports: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>>]>>>, Record<string, string | Record<string, string | undefined> | Record<string, Record<string, string | undefined> | undefined> | undefined> | undefined, Record<string, string | Record<string, string | undefined> | Record<string, Record<string, string | undefined> | undefined> | undefined>>>;
360
+ exports: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodType<any, z.ZodTypeDef, any>>]>, string | Record<string, any> | null | undefined, string | Record<string, any> | null>>;
359
361
  }, z.ZodTypeAny, "passthrough">>;
360
362
  export type Package_Json = z.infer<typeof Package_Json>;
361
363
  export type Map_Package_Json = (package_json: Package_Json) => Package_Json | null | Promise<Package_Json | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"package_json.d.ts","sourceRoot":"../src/lib/","sources":["package_json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAUtD,eAAO,MAAM,GAAG,aAAa,CAAC;AAC9B,MAAM,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;AAGvD,eAAO,MAAM,KAAK,aAAa,CAAC;AAChC,MAAM,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;AAG7D,eAAO,MAAM,mCAAmC,GAAI,CAAC,OAAO,CAAC,KAAG,CAAC,GAAG,SAKnE,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;kCASlC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE9E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;kCAS9B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,eAAO,MAAM,oBAAoB;;;;;;;;;kCAQ/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAOxE,eAAO,MAAM,oBAAoB,yNAQhC,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAA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sC,CAAC;AAExE,eAAO,MAAM,iBAAiB,yBAErB,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,sBAElC,YAiBF,CAAC;AAEF,eAAO,MAAM,iBAAiB,qBACX,gBAAgB,OAC7B,MAAM,0DAIT,OAAO,CAAC;IAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,CA2B/D,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAO,YAAiD,CAAC;AAM3F,eAAO,MAAM,kBAAkB,4BAA6B,MAAM,KAAG,IAEpE,CAAC;AAEF,eAAO,MAAM,sBAAsB,iBAAkB,YAAY,KAAG,MACW,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,mBAAmB,oCAEvB,CAAC,YAAY,EAAE,YAAY,KAAK,YAAY,GAAG,IAAI,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,sBAExF,OAAO,CAAC;IAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,CAa/D,CAAC;AAIF,eAAO,MAAM,kBAAkB,UAAW,MAAM,EAAE,KAAG,oBA6CpD,CAAC;AAIF,eAAO,MAAM,cAAc,iBACZ,YAAY,KACxB;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAG,SAgBlC,CAAC;AA8BF,eAAO,MAAM,OAAO,aACT,MAAM,iBACF,YAAY,KACxB,OAGyC,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,YAAY,iBAAkB,YAAY,KAAG,gBAAgB,EAezE,CAAC"}
@@ -48,18 +48,18 @@ export const Package_Json_Funding = z.union([
48
48
  })
49
49
  .passthrough(),
50
50
  ]);
51
- // exports: {
52
- // './': './index.js',
53
- // './record': {default: './record.js'},
54
- // './export_condition': {default: {development: './ec1', default: './ec2.js'}},
55
- // }
56
- export const Package_Json_Exports = z.record(z
57
- .union([
58
- z.string(),
59
- z.record(z.string().optional()),
60
- z.record(z.record(z.string().optional()).optional()),
61
- ])
62
- .optional());
51
+ // Helper to create a recursive type that represents export conditions and values
52
+ const create_export_value_schema = () => {
53
+ return z.lazy(() => z.union([z.string(), z.null(), z.record(z.lazy(() => export_value_schema))]));
54
+ };
55
+ // The base export value schema that can be a string, null, or nested conditions
56
+ const export_value_schema = create_export_value_schema();
57
+ export const Export_Value = export_value_schema;
58
+ // Package exports can be:
59
+ // 1. A string (shorthand for main export)
60
+ // 2. null (to block exports)
61
+ // 3. A record of export conditions/paths
62
+ export const Package_Json_Exports = z.union([z.string(), z.null(), z.record(export_value_schema)]);
63
63
  /**
64
64
  * @see https://docs.npmjs.com/cli/v10/configuring-npm/package-json
65
65
  */
@@ -1,10 +1,7 @@
1
1
  import { Package_Json } from './package_json.js';
2
2
  import type { Resolved_Specifier } from './resolve_specifier.js';
3
3
  /**
4
- * Like `resolve_specifier` but for Node specifiers,
5
- * typically those that aren't relative or absolute.
6
- * Optionally return `null` instead of throwing by setting
7
- * `throw_on_missing_package` to `false`.
4
+ * This likely has differences from Node - they should be fixed on a case-by-case basis.
8
5
  */
9
- export declare const resolve_node_specifier: (specifier: string, dir?: string, parent_path?: string, cache?: Record<string, Package_Json>, throw_on_missing_package?: boolean, exports_condition?: string) => Resolved_Specifier | null;
6
+ export declare const resolve_node_specifier: (specifier: string, dir?: string, parent_path?: string, cache?: Record<string, Package_Json>, throw_on_missing_package?: boolean, exports_conditions?: string[]) => Resolved_Specifier | null;
10
7
  //# sourceMappingURL=resolve_node_specifier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve_node_specifier.d.ts","sourceRoot":"../src/lib/","sources":["resolve_node_specifier.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,YAAY,EAA0C,MAAM,mBAAmB,CAAC;AAGxF,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,cACvB,MAAM,8BAEH,MAAM,UACZ,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,qEAIlC,kBAAkB,GAAG,IAqEvB,CAAC"}
1
+ {"version":3,"file":"resolve_node_specifier.d.ts","sourceRoot":"../src/lib/","sources":["resolve_node_specifier.ts"],"names":[],"mappings":"AAIA,OAAO,EAAe,YAAY,EAAoB,MAAM,mBAAmB,CAAC;AAGhF,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAG/D;;GAEG;AACH,eAAO,MAAM,sBAAsB,cACvB,MAAM,8BAEH,MAAM,UACZ,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,wEAGlC,kBAAkB,GAAG,IA6FvB,CAAC"}
@@ -1,24 +1,19 @@
1
- import { join } from 'node:path';
1
+ import { join, extname } from 'node:path';
2
2
  import { existsSync } from 'node:fs';
3
3
  import { DEV } from 'esm-env';
4
- import { Package_Json, Package_Json_Exports, load_package_json } from './package_json.js';
4
+ import { Export_Value, Package_Json, load_package_json } from './package_json.js';
5
5
  import { paths } from './paths.js';
6
6
  import { NODE_MODULES_DIRNAME } from './constants.js';
7
+ import { escape_regexp } from '@ryanatkn/belt/regexp.js';
7
8
  /**
8
- * Like `resolve_specifier` but for Node specifiers,
9
- * typically those that aren't relative or absolute.
10
- * Optionally return `null` instead of throwing by setting
11
- * `throw_on_missing_package` to `false`.
9
+ * This likely has differences from Node - they should be fixed on a case-by-case basis.
12
10
  */
13
- export const resolve_node_specifier = (specifier, dir = paths.root, parent_path, cache, throw_on_missing_package = true,
14
- // TODO this needs to use `--conditions`/`-C` to determine the correct key
15
- exports_condition = DEV ? 'development' : 'default') => {
11
+ export const resolve_node_specifier = (specifier, dir = paths.root, parent_path, cache, throw_on_missing_package = true, exports_conditions = DEV ? ['development', 'node', 'import'] : ['production', 'node', 'import']) => {
16
12
  const raw = specifier.endsWith('?raw');
17
13
  const mapped_specifier = raw ? specifier.substring(0, specifier.length - 4) : specifier;
18
14
  // Parse the specifier
19
15
  let idx = -1;
20
16
  if (mapped_specifier[0] === '@') {
21
- // get the index of the second `/`
22
17
  let count = 0;
23
18
  for (let i = 0; i < mapped_specifier.length; i++) {
24
19
  if (mapped_specifier[i] === '/')
@@ -36,7 +31,12 @@ exports_condition = DEV ? 'development' : 'default') => {
36
31
  const module_path = idx === -1 ? '' : mapped_specifier.substring(idx + 1);
37
32
  const subpath = module_path ? './' + module_path : '.';
38
33
  const package_dir = join(dir, NODE_MODULES_DIRNAME, pkg_name);
39
- if (!existsSync(package_dir)) {
34
+ // Check cache first
35
+ let package_json;
36
+ if (cache?.[pkg_name]) {
37
+ package_json = cache[pkg_name];
38
+ }
39
+ else if (!existsSync(package_dir)) {
40
40
  if (throw_on_missing_package) {
41
41
  throw Error(`Package not found at ${package_dir} for specifier ${specifier}, you may need to install packages or fix the path` +
42
42
  (parent_path ? ` imported from ${parent_path}` : ''));
@@ -45,11 +45,25 @@ exports_condition = DEV ? 'development' : 'default') => {
45
45
  return null;
46
46
  }
47
47
  }
48
- const package_json = load_package_json(package_dir, cache, false);
49
- const { exported, exports_key } = resolve_subpath(package_json, specifier, subpath);
48
+ else {
49
+ package_json = load_package_json(package_dir, cache, false);
50
+ }
51
+ // Handle self-referencing
52
+ if (parent_path?.startsWith(package_dir)) {
53
+ if (!package_json.exports) {
54
+ throw Error(`Self-referencing is only available if package.json has "exports" field: ${specifier}` +
55
+ (parent_path ? ` imported from ${parent_path}` : ''));
56
+ }
57
+ }
58
+ const exported = resolve_subpath(package_json, subpath);
59
+ if (typeof exported === 'string') {
60
+ const validated = validate_export_target(exported, throw_on_missing_package);
61
+ if (validated === null) {
62
+ return null;
63
+ }
64
+ }
50
65
  if (!exported) {
51
66
  if (throw_on_missing_package) {
52
- // same error message as Node
53
67
  throw Error(`[ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath '${subpath}' is not defined by 'exports' in ${package_dir}/package.json` +
54
68
  (parent_path ? ` imported from ${parent_path}` : ''));
55
69
  }
@@ -57,17 +71,17 @@ exports_condition = DEV ? 'development' : 'default') => {
57
71
  return null;
58
72
  }
59
73
  }
60
- const exported_value = resolve_exported_value(exported, exports_key, exports_condition);
74
+ const exported_value = resolve_exported_value(exported, exports_conditions);
61
75
  if (exported_value === undefined) {
62
76
  if (throw_on_missing_package) {
63
- throw Error(`Package subpath '${subpath}' does not define the key '${exports_key}' in 'exports' in ${package_dir}/package.json` +
77
+ throw Error(`No valid export found for subpath '${subpath}' in ${package_dir}/package.json with the following conditions: ${exports_conditions.join(', ')}` +
64
78
  (parent_path ? ` imported from ${parent_path}` : ''));
65
79
  }
66
80
  else {
67
81
  return null;
68
82
  }
69
83
  }
70
- const path_id = join(package_dir, exported_value);
84
+ const path_id = normalize_extension(join(package_dir, exported_value));
71
85
  return {
72
86
  path_id,
73
87
  path_id_with_querystring: raw ? path_id + '?raw' : path_id,
@@ -77,32 +91,207 @@ exports_condition = DEV ? 'development' : 'default') => {
77
91
  namespace: undefined,
78
92
  };
79
93
  };
80
- /**
81
- * Resolves the subpath of a package.json `exports` field based on the `specifier`.
82
- */
83
- const resolve_subpath = (package_json, specifier, subpath) => {
84
- const exports_key = specifier.endsWith('.svelte') ? 'svelte' : 'default';
85
- const exported = subpath === '.' && !package_json.exports
86
- ? { [exports_key]: package_json.main }
87
- : package_json.exports?.[subpath];
88
- return { exported, exports_key };
94
+ const replace_wildcards = (pattern, wildcards) => {
95
+ if (!pattern.includes('*'))
96
+ return pattern;
97
+ let result = pattern;
98
+ let wildcard_index = 0;
99
+ while (result.includes('*') && wildcard_index < wildcards.length) {
100
+ result = result.replace('*', wildcards[wildcard_index++]);
101
+ }
102
+ return result;
89
103
  };
90
- /**
91
- * Resolves the exported value based on the exports key and condition.
92
- */
93
- const resolve_exported_value = (exported, exports_key, exports_condition) => {
94
- let exported_value = typeof exported === 'string' ? exported : exported[exports_key];
95
- // TODO best effort fallback, support `default` but fall back to `import` or `node` as the exports key.
96
- if (exported_value === undefined && typeof exported !== 'string' && exports_key === 'default') {
97
- exported_value = exported.import ?? exported.node;
98
- }
99
- // Possibly resolve to conditional exports.
100
- exported_value =
101
- exported_value === undefined || typeof exported_value === 'string'
102
- ? exported_value
103
- : (exported_value[exports_condition] ??
104
- exported_value.default ??
105
- exported_value.import ??
106
- exported_value.node); // TODO this fallback has corner case bugs for off-spec exports
107
- return exported_value;
104
+ const resolve_subpath = (package_json, subpath) => {
105
+ // If no exports field exists, fallback to main field for the root subpath
106
+ if (!package_json.exports) {
107
+ return subpath === '.' && package_json.main ? package_json.main : null;
108
+ }
109
+ const exports = package_json.exports;
110
+ // Handle exports sugar syntax
111
+ if (typeof exports === 'string') {
112
+ return subpath === '.' ? exports : null;
113
+ }
114
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
115
+ if (typeof exports === 'object' && exports !== null) {
116
+ // Check for exact match first
117
+ if (subpath in exports) {
118
+ return exports[subpath];
119
+ }
120
+ // Sort patterns by specificity
121
+ const patterns = Object.entries(exports)
122
+ .filter(([pattern]) => pattern.includes('*'))
123
+ .map(([pattern, target]) => ({
124
+ pattern,
125
+ target,
126
+ static_prefix: pattern.split('*')[0],
127
+ segments: pattern.split('/').length,
128
+ wildcards: (pattern.match(/\*/g) ?? []).length,
129
+ }))
130
+ .sort((a, b) => {
131
+ // Sort by static prefix length first
132
+ const prefix_diff = b.static_prefix.length - a.static_prefix.length;
133
+ if (prefix_diff !== 0)
134
+ return prefix_diff;
135
+ // Then by number of segments
136
+ const segment_diff = b.segments - a.segments;
137
+ if (segment_diff !== 0)
138
+ return segment_diff;
139
+ // Then by number of wildcards (fewer is more specific)
140
+ const wildcard_diff = a.wildcards - b.wildcards;
141
+ if (wildcard_diff !== 0)
142
+ return wildcard_diff;
143
+ // Finally by total pattern length
144
+ return b.pattern.length - a.pattern.length;
145
+ });
146
+ // Track matched wildcards for later use
147
+ let matched_wildcards = [];
148
+ // Check patterns in order of specificity
149
+ for (const { pattern, target } of patterns) {
150
+ // Convert pattern to regex, handling path segments properly
151
+ const regex_pattern = pattern.split('*').map(escape_regexp).join('([^/]+)');
152
+ const regex = new RegExp(`^${regex_pattern}$`);
153
+ const match = subpath.match(regex);
154
+ if (match) {
155
+ // If this is a null pattern and it matches, block access
156
+ if (target === null)
157
+ return null;
158
+ // Extract captured wildcards and store them
159
+ matched_wildcards = match.slice(1);
160
+ if (typeof target === 'string') {
161
+ return replace_wildcards(target, matched_wildcards);
162
+ }
163
+ if (typeof target === 'object' && target !== null) {
164
+ // For conditional exports, return an object with resolved wildcards
165
+ return Object.fromEntries(Object.entries(target).map(([key, value]) => {
166
+ if (typeof value === 'string') {
167
+ return [key, replace_wildcards(value, matched_wildcards)];
168
+ }
169
+ // Handle nested conditions
170
+ if (typeof value === 'object' && value !== null) {
171
+ return [
172
+ key,
173
+ Object.fromEntries(Object.entries(value).map(([nested_key, nested_value]) => [
174
+ nested_key,
175
+ typeof nested_value === 'string'
176
+ ? replace_wildcards(nested_value, matched_wildcards)
177
+ : nested_value,
178
+ ])),
179
+ ];
180
+ }
181
+ return [key, value];
182
+ }));
183
+ }
184
+ }
185
+ }
186
+ // Handle catch-all patterns for remaining cases
187
+ const catch_all_patterns = patterns.filter(({ pattern }) => pattern.endsWith('/*') || pattern === './*');
188
+ for (const { pattern, target } of catch_all_patterns) {
189
+ const base_pattern = pattern.slice(0, -1); // Remove trailing '*'
190
+ if (subpath.startsWith(base_pattern)) {
191
+ if (target === null)
192
+ return null;
193
+ const remainder = subpath.slice(base_pattern.length);
194
+ if (typeof target === 'string') {
195
+ return target.slice(0, -1) + remainder;
196
+ }
197
+ }
198
+ }
199
+ }
200
+ return null;
201
+ };
202
+ const resolve_exported_value = (exported, conditions) => {
203
+ if (typeof exported === 'string') {
204
+ return exported;
205
+ }
206
+ if (typeof exported !== 'object' || exported === null) {
207
+ return undefined;
208
+ }
209
+ const exported_obj = exported;
210
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
211
+ let default_value;
212
+ // For each key in exported_obj, in order
213
+ for (const [condition, value] of Object.entries(exported_obj)) {
214
+ // Skip invalid conditions
215
+ if (!is_valid_condition(condition)) {
216
+ continue;
217
+ }
218
+ if (condition === 'default') {
219
+ // Store default value to try last
220
+ default_value = value;
221
+ }
222
+ else if (conditions.includes(condition)) {
223
+ const resolved = resolve_exported_value(value, conditions);
224
+ if (resolved !== undefined) {
225
+ return resolved;
226
+ }
227
+ }
228
+ }
229
+ // If no conditions matched, try default
230
+ if (default_value !== undefined) {
231
+ const resolved = resolve_exported_value(default_value, conditions);
232
+ if (resolved !== undefined) {
233
+ return resolved;
234
+ }
235
+ }
236
+ return undefined;
237
+ };
238
+ const is_valid_condition = (condition) => {
239
+ if (condition.length === 0 ||
240
+ condition.startsWith('.') ||
241
+ condition.includes(',') ||
242
+ /^\d+$/.test(condition)) {
243
+ return false;
244
+ }
245
+ return /^[a-zA-Z0-9:_\-=]+$/.test(condition);
246
+ };
247
+ const normalize_extension = (path) => {
248
+ if (path.endsWith('.d.ts')) {
249
+ return path.slice(0, -5) + '.js';
250
+ }
251
+ // No extension handling needed if path already has an extension
252
+ if (extname(path)) {
253
+ return path;
254
+ }
255
+ // If no extension at all, add .js
256
+ return path + '.js';
257
+ };
258
+ const validate_export_target = (target, throw_on_missing_package) => {
259
+ // Must start with './'
260
+ if (!target.startsWith('./') && !target.startsWith('../')) {
261
+ if (throw_on_missing_package) {
262
+ throw new Error('ERR_INVALID_PACKAGE_TARGET: Export target must start with "./" or "../"');
263
+ }
264
+ else {
265
+ return null;
266
+ }
267
+ }
268
+ // Can't contain node_modules
269
+ if (target.includes('node_modules')) {
270
+ if (throw_on_missing_package) {
271
+ throw new Error('ERR_INVALID_PACKAGE_TARGET: Export target cannot contain node_modules');
272
+ }
273
+ else {
274
+ return null;
275
+ }
276
+ }
277
+ // Check for package boundary escape
278
+ const parts = target.split('/');
279
+ let depth = 0;
280
+ for (const part of parts) {
281
+ if (part === '..') {
282
+ depth--;
283
+ // If we go above root, it's escaping the package boundary
284
+ if (depth < 0) {
285
+ if (throw_on_missing_package) {
286
+ throw new Error('ERR_INVALID_PACKAGE_TARGET: Export target cannot escape package boundary');
287
+ }
288
+ else {
289
+ return null;
290
+ }
291
+ }
292
+ }
293
+ else if (part !== '.' && part !== '') {
294
+ depth++;
295
+ }
296
+ }
108
297
  };
@@ -12,7 +12,7 @@ export declare const SVELTEKIT_ENV_MATCHER: RegExp;
12
12
  export declare const has_sveltekit_app: () => Result<object, {
13
13
  message: string;
14
14
  }>;
15
- export declare const has_sveltekit_library: (package_json?: Package_Json, sveltekit_config?: Parsed_Sveltekit_Config, dep_name?: string, pm_cli?: string) => Result<object, {
15
+ export declare const has_sveltekit_library: (package_json?: Package_Json, sveltekit_config?: Parsed_Sveltekit_Config, dep_name?: string) => Result<object, {
16
16
  message: string;
17
17
  }>;
18
18
  export declare const sveltekit_sync: (sveltekit_cli?: string | Cli, pm_cli?: string) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"sveltekit_helpers.d.ts","sourceRoot":"../src/lib/","sources":["sveltekit_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAErD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EAAC,YAAY,EAAU,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAA2B,KAAK,uBAAuB,EAAC,MAAM,uBAAuB,CAAC;AAE7F,OAAO,EAAmC,KAAK,GAAG,EAAC,MAAM,UAAU,CAAC;AAIpE,eAAO,MAAM,aAAa,eAAe,CAAC;AAE1C,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAE/C,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AACnD,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAE3D,eAAO,MAAM,QAAQ,SAAS,CAAC;AAE/B,eAAO,MAA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