@ryanatkn/gro 0.144.1 → 0.145.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.
@@ -1 +1 @@
1
- {"version":3,"file":"gro.config.default.d.ts","sourceRoot":"../src/lib/","sources":["gro.config.default.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAQvD;;;;;;;;GAQG;AACH,QAAA,MAAM,MAAM,EAAE,iBA0Bb,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"gro.config.default.d.ts","sourceRoot":"../src/lib/","sources":["gro.config.default.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AASvD;;;;;;;;GAQG;AACH,QAAA,MAAM,MAAM,EAAE,iBA4Bb,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -4,6 +4,7 @@ import { gro_plugin_sveltekit_app } from './gro_plugin_sveltekit_app.js';
4
4
  import { has_sveltekit_app, has_sveltekit_library } from './sveltekit_helpers.js';
5
5
  import { gro_plugin_gen } from './gro_plugin_gen.js';
6
6
  import { gro_plugin_moss, has_moss_dep } from './gro_plugin_moss.js';
7
+ import { load_package_json } from './package_json.js';
7
8
  /**
8
9
  * This is the default config that's passed to `gro.config.ts`
9
10
  * if it exists in the current project, and if not, this is the final config.
@@ -14,10 +15,11 @@ import { gro_plugin_moss, has_moss_dep } from './gro_plugin_moss.js';
14
15
  * - if `src/lib/server/server.ts`, assumes a Node server
15
16
  */
16
17
  const config = async (cfg) => {
18
+ const package_json = load_package_json(); // TODO gets wastefully loaded by some plugins, maybe put in plugin/task context? how does that interact with `map_package_json`?
17
19
  const [moss_plugin_result, has_server_result, has_sveltekit_library_result, has_sveltekit_app_result,] = await Promise.all([
18
- has_moss_dep(),
20
+ has_moss_dep(package_json),
19
21
  has_server(),
20
- has_sveltekit_library(),
22
+ has_sveltekit_library(package_json),
21
23
  has_sveltekit_app(),
22
24
  ]);
23
25
  cfg.plugins = () => [
@@ -4,7 +4,7 @@ import type { Args } from './args.js';
4
4
  import type { File_Filter } from './path.js';
5
5
  import { type Package_Json } from './package_json.js';
6
6
  export declare const MOSS_PACKAGE_DEP_NAME = "@ryanatkn/moss";
7
- export declare const has_moss_dep: (package_json?: Package_Json, dep_name?: string) => Result<object, {
7
+ export declare const has_moss_dep: (package_json: Package_Json, dep_name?: string) => Result<object, {
8
8
  message: string;
9
9
  }>;
10
10
  export declare const generate_classes_css: (classes: Iterable<string>) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"gro_plugin_moss.d.ts","sourceRoot":"../src/lib/","sources":["gro_plugin_moss.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAErD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAGpC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAU,KAAK,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAE7D,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AAEtD,eAAO,MAAM,YAAY,kBACT,YAAY,wBAEzB,MAAM,CAAC,MAAM,EAAE;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,CASlC,CAAC;AAEF,eAAO,MAAM,oBAAoB,YAAa,QAAQ,CAAC,MAAM,CAAC,KAAG,MAmBhE,CAAC;AAIF,MAAM,WAAW,SAAU,SAAQ,IAAI;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,OAAO;IACvB,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAA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library.d.ts","sourceRoot":"../src/lib/","sources":["gro_plugin_sveltekit_library.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAGxC,OAAO,EAGN,KAAK,sBAAsB,EAC3B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,oCAAoC;IACpD;;;OAGG;IACH,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IAChD;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,4BAA4B,qDAGtC,oCAAoC,KAAQ,MA8B9C,CAAC"}
1
+ {"version":3,"file":"gro_plugin_sveltekit_library.d.ts","sourceRoot":"../src/lib/","sources":["gro_plugin_sveltekit_library.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAGxC,OAAO,EAGN,KAAK,sBAAsB,EAC3B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,oCAAoC;IACpD;;;OAGG;IACH,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IAChD;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,4BAA4B,qDAGtC,oCAAoC,KAAQ,MAoC9C,CAAC"}
@@ -3,15 +3,15 @@ import { Task_Error } from './task.js';
3
3
  import { load_package_json } from './package_json.js';
4
4
  import { SVELTE_PACKAGE_CLI, run_svelte_package, } from './sveltekit_helpers.js';
5
5
  export const gro_plugin_sveltekit_library = ({ svelte_package_options, svelte_package_cli = SVELTE_PACKAGE_CLI, } = {}) => {
6
+ const package_json = load_package_json();
6
7
  return {
7
8
  name: 'gro_plugin_sveltekit_library',
8
9
  setup: async ({ dev, log, config }) => {
9
10
  if (!dev) {
10
- await run_svelte_package(svelte_package_options, svelte_package_cli, log, config.pm_cli);
11
+ await run_svelte_package(package_json, svelte_package_options, svelte_package_cli, log, config.pm_cli);
11
12
  }
12
13
  },
13
14
  adapt: async ({ log, timings, config }) => {
14
- const package_json = load_package_json();
15
15
  // link the CLI binaries if they exist
16
16
  if (package_json.bin) {
17
17
  const timing_to_link = timings.start(`${config.pm_cli} link`);
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"../src/lib/","sources":["loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAgFvD,eAAO,MAAM,IAAI,EAAE,QAwFlB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WA4DrB,CAAC"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"../src/lib/","sources":["loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAgFvD,eAAO,MAAM,IAAI,EAAE,QAwFlB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WA6DrB,CAAC"}
package/dist/loader.js CHANGED
@@ -148,6 +148,7 @@ export const resolve = async (specifier, context, nextResolve) => {
148
148
  }
149
149
  // Special case for Gro's dependencies that import into Gro.
150
150
  // Without this, we'd need to add a dev dep to Gro for Gro, which causes problems.
151
+ // TODO maybe make this generic, checking `package_json.name` against `s` and map it, possibly need to export `resolve_exported_value`
151
152
  if (IS_THIS_GRO && s.startsWith('@ryanatkn/gro')) {
152
153
  s = join(dir, 'dist', s.substring(13));
153
154
  }
package/dist/package.d.ts CHANGED
@@ -285,10 +285,6 @@ export declare const package_json: {
285
285
  types: string;
286
286
  default: string;
287
287
  };
288
- './moss_helpers.js': {
289
- types: string;
290
- default: string;
291
- };
292
288
  './package_json.js': {
293
289
  types: string;
294
290
  default: string;
@@ -864,16 +860,6 @@ export declare const src_json: {
864
860
  kind: "function";
865
861
  })[];
866
862
  };
867
- './moss_helpers.js': {
868
- path: string;
869
- declarations: ({
870
- name: string;
871
- kind: "variable";
872
- } | {
873
- name: string;
874
- kind: "function";
875
- })[];
876
- };
877
863
  './package_json.js': {
878
864
  path: string;
879
865
  declarations: ({
@@ -1 +1 @@
1
- {"version":3,"file":"package.d.ts","sourceRoot":"../src/lib/","sources":["package.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwQD,CAAC;AAEzB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8wBD,CAAC"}
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.144.1',
4
+ version: '0.145.0',
5
5
  description: 'task runner and toolkit extending SvelteKit',
6
6
  motto: 'generate, run, optimize',
7
7
  glyph: '🌰',
@@ -181,7 +181,6 @@ export const package_json = {
181
181
  './loader.js': { types: './dist/loader.d.ts', default: './dist/loader.js' },
182
182
  './module.js': { types: './dist/module.d.ts', default: './dist/module.js' },
183
183
  './modules.js': { types: './dist/modules.d.ts', default: './dist/modules.js' },
184
- './moss_helpers.js': { types: './dist/moss_helpers.d.ts', default: './dist/moss_helpers.js' },
185
184
  './package_json.js': { types: './dist/package_json.d.ts', default: './dist/package_json.js' },
186
185
  './package_meta.js': { types: './dist/package_meta.d.ts', default: './dist/package_meta.js' },
187
186
  './package.gen.js': { types: './dist/package.gen.d.ts', default: './dist/package.gen.js' },
@@ -265,7 +264,7 @@ export const package_json = {
265
264
  };
266
265
  export const src_json = {
267
266
  name: '@ryanatkn/gro',
268
- version: '0.144.1',
267
+ version: '0.145.0',
269
268
  modules: {
270
269
  '.': {
271
270
  path: 'index.ts',
@@ -697,13 +696,6 @@ export const src_json = {
697
696
  { name: 'load_modules', kind: 'function' },
698
697
  ],
699
698
  },
700
- './moss_helpers.js': {
701
- path: 'moss_helpers.ts',
702
- declarations: [
703
- { name: 'MOSS_PACKAGE_DEP_NAME', kind: 'variable' },
704
- { name: 'load_moss_plugin', kind: 'function' },
705
- ],
706
- },
707
699
  './package_json.js': {
708
700
  path: 'package_json.ts',
709
701
  declarations: [
@@ -1 +1 @@
1
- {"version":3,"file":"publish.task.d.ts","sourceRoot":"../src/lib/","sources":["publish.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAgBhD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBP,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA0I3B,CAAC"}
1
+ {"version":3,"file":"publish.task.d.ts","sourceRoot":"../src/lib/","sources":["publish.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAgBhD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBP,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA2I3B,CAAC"}
@@ -43,7 +43,8 @@ export const task = {
43
43
  if (dry) {
44
44
  log.info(st('green', 'dry run!'));
45
45
  }
46
- const has_sveltekit_library_result = has_sveltekit_library();
46
+ const package_json = load_package_json();
47
+ const has_sveltekit_library_result = has_sveltekit_library(package_json);
47
48
  if (!has_sveltekit_library_result.ok) {
48
49
  throw new Task_Error('Failed to find SvelteKit library: ' + has_sveltekit_library_result.message);
49
50
  }
@@ -76,11 +77,10 @@ export const task = {
76
77
  log.info('dry run, skipping changeset version');
77
78
  }
78
79
  else {
79
- const package_json_before = load_package_json();
80
- if (typeof package_json_before.version !== 'string') {
80
+ if (typeof package_json.version !== 'string') {
81
81
  throw new Task_Error('Failed to find package.json version');
82
82
  }
83
- const parsed_repo_url = parse_repo_url(package_json_before);
83
+ const parsed_repo_url = parse_repo_url(package_json);
84
84
  if (!parsed_repo_url) {
85
85
  throw new Task_Error('package.json `repository` must contain a repo url (and GitHub only for now, sorry),' +
86
86
  ' like `git+https://github.com/ryanatkn/gro.git` or `https://github.com/ryanatkn/gro`' +
@@ -98,9 +98,9 @@ export const task = {
98
98
  }
99
99
  await update_changelog(parsed_repo_url.owner, parsed_repo_url.repo, changelog, token, log);
100
100
  }
101
- const package_json_after = load_package_json();
102
- version = package_json_after.version;
103
- if (package_json_before.version === version) {
101
+ const package_json_after_versioning = load_package_json();
102
+ version = package_json_after_versioning.version;
103
+ if (package_json.version === version) {
104
104
  // The version didn't change.
105
105
  // For now this is the best detection we have for a no-op `changeset version`.
106
106
  if (optional) {
@@ -1 +1 @@
1
- {"version":3,"file":"release.task.d.ts","sourceRoot":"../src/lib/","sources":["release.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,IAAI,iDAAwB,CAAC;AAC1C,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAY3B,CAAC"}
1
+ {"version":3,"file":"release.task.d.ts","sourceRoot":"../src/lib/","sources":["release.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,IAAI,iDAAwB,CAAC;AAC1C,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAc3B,CAAC"}
@@ -1,11 +1,13 @@
1
1
  import { z } from 'zod';
2
2
  import { has_sveltekit_library, has_sveltekit_app } from './sveltekit_helpers.js';
3
+ import { load_package_json } from './package_json.js';
3
4
  export const Args = z.object({}).strict();
4
5
  export const task = {
5
6
  summary: 'publish and deploy',
6
7
  Args,
7
8
  run: async ({ invoke_task }) => {
8
- const publish = has_sveltekit_library().ok;
9
+ const package_json = load_package_json();
10
+ const publish = has_sveltekit_library(package_json).ok;
9
11
  if (publish) {
10
12
  await invoke_task('publish', { optional: true });
11
13
  }
@@ -3,5 +3,5 @@ import type { Resolved_Specifier } from './resolve_specifier.js';
3
3
  /**
4
4
  * This likely has differences from Node - they should be fixed on a case-by-case basis.
5
5
  */
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;
6
+ export declare const resolve_node_specifier: (specifier: string, dir?: string, parent_path?: string, package_json_cache?: Record<string, Package_Json>, throw_on_missing_package?: boolean, exports_conditions?: string[]) => Resolved_Specifier | null;
7
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,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
+ {"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,uBACC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,wEAG/C,kBAAkB,GAAG,IA6FvB,CAAC"}
@@ -8,7 +8,7 @@ import { escape_regexp } from '@ryanatkn/belt/regexp.js';
8
8
  /**
9
9
  * This likely has differences from Node - they should be fixed on a case-by-case basis.
10
10
  */
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']) => {
11
+ export const resolve_node_specifier = (specifier, dir = paths.root, parent_path, package_json_cache, throw_on_missing_package = true, exports_conditions = DEV ? ['development', 'node', 'import'] : ['production', 'node', 'import']) => {
12
12
  const raw = specifier.endsWith('?raw');
13
13
  const mapped_specifier = raw ? specifier.substring(0, specifier.length - 4) : specifier;
14
14
  // Parse the specifier
@@ -31,10 +31,10 @@ export const resolve_node_specifier = (specifier, dir = paths.root, parent_path,
31
31
  const module_path = idx === -1 ? '' : mapped_specifier.substring(idx + 1);
32
32
  const subpath = module_path ? './' + module_path : '.';
33
33
  const package_dir = join(dir, NODE_MODULES_DIRNAME, pkg_name);
34
- // Check cache first
34
+ // Check package_json cache first
35
35
  let package_json;
36
- if (cache?.[pkg_name]) {
37
- package_json = cache[pkg_name];
36
+ if (package_json_cache?.[pkg_name]) {
37
+ package_json = package_json_cache[pkg_name];
38
38
  }
39
39
  else if (!existsSync(package_dir)) {
40
40
  if (throw_on_missing_package) {
@@ -46,7 +46,7 @@ export const resolve_node_specifier = (specifier, dir = paths.root, parent_path,
46
46
  }
47
47
  }
48
48
  else {
49
- package_json = load_package_json(package_dir, cache, false);
49
+ package_json = load_package_json(package_dir, package_json_cache, false);
50
50
  }
51
51
  // Handle self-referencing
52
52
  if (parent_path?.startsWith(package_dir)) {
@@ -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) => 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>;
@@ -73,7 +73,7 @@ export interface Svelte_Package_Options {
73
73
  */
74
74
  tsconfig?: string;
75
75
  }
76
- export declare const run_svelte_package: (options: Svelte_Package_Options | undefined, cli: string | Cli, log: Logger, pm_cli: string) => Promise<void>;
76
+ export declare const run_svelte_package: (package_json: Package_Json, options: Svelte_Package_Options | undefined, cli: string | Cli, log: Logger, pm_cli: string) => Promise<void>;
77
77
  /**
78
78
  * Map an import specifier with the SvelteKit aliases.
79
79
  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eAAO,MAAM,qBAAqB,cACtB,MAAM,WACR,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAC9B,MASF,CAAC"}
@@ -67,8 +67,8 @@ export const sveltekit_sync_if_obviously_needed = async (sveltekit_cli = SVELTEK
67
67
  }
68
68
  return sveltekit_sync(found_sveltekit_cli);
69
69
  };
70
- export const run_svelte_package = async (options, cli, log, pm_cli) => {
71
- const has_sveltekit_library_result = has_sveltekit_library();
70
+ export const run_svelte_package = async (package_json, options, cli, log, pm_cli) => {
71
+ const has_sveltekit_library_result = has_sveltekit_library(package_json);
72
72
  if (!has_sveltekit_library_result.ok) {
73
73
  throw new Task_Error('Failed to find SvelteKit library: ' + has_sveltekit_library_result.message);
74
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryanatkn/gro",
3
- "version": "0.144.1",
3
+ "version": "0.145.0",
4
4
  "description": "task runner and toolkit extending SvelteKit",
5
5
  "motto": "generate, run, optimize",
6
6
  "glyph": "🌰",
@@ -306,10 +306,6 @@
306
306
  "types": "./dist/modules.d.ts",
307
307
  "default": "./dist/modules.js"
308
308
  },
309
- "./moss_helpers.js": {
310
- "types": "./dist/moss_helpers.d.ts",
311
- "default": "./dist/moss_helpers.js"
312
- },
313
309
  "./package_json.js": {
314
310
  "types": "./dist/package_json.d.ts",
315
311
  "default": "./dist/package_json.js"
@@ -5,6 +5,7 @@ import {gro_plugin_sveltekit_app} from './gro_plugin_sveltekit_app.js';
5
5
  import {has_sveltekit_app, has_sveltekit_library} from './sveltekit_helpers.js';
6
6
  import {gro_plugin_gen} from './gro_plugin_gen.js';
7
7
  import {gro_plugin_moss, has_moss_dep} from './gro_plugin_moss.js';
8
+ import {load_package_json} from './package_json.js';
8
9
 
9
10
  /**
10
11
  * This is the default config that's passed to `gro.config.ts`
@@ -16,15 +17,17 @@ import {gro_plugin_moss, has_moss_dep} from './gro_plugin_moss.js';
16
17
  * - if `src/lib/server/server.ts`, assumes a Node server
17
18
  */
18
19
  const config: Create_Gro_Config = async (cfg) => {
20
+ const package_json = load_package_json(); // TODO gets wastefully loaded by some plugins, maybe put in plugin/task context? how does that interact with `map_package_json`?
21
+
19
22
  const [
20
23
  moss_plugin_result,
21
24
  has_server_result,
22
25
  has_sveltekit_library_result,
23
26
  has_sveltekit_app_result,
24
27
  ] = await Promise.all([
25
- has_moss_dep(),
28
+ has_moss_dep(package_json),
26
29
  has_server(),
27
- has_sveltekit_library(),
30
+ has_sveltekit_library(package_json),
28
31
  has_sveltekit_app(),
29
32
  ]);
30
33
 
@@ -16,7 +16,7 @@ import {has_dep, type Package_Json} from './package_json.js';
16
16
  export const MOSS_PACKAGE_DEP_NAME = '@ryanatkn/moss';
17
17
 
18
18
  export const has_moss_dep = (
19
- package_json?: Package_Json,
19
+ package_json: Package_Json,
20
20
  dep_name = MOSS_PACKAGE_DEP_NAME,
21
21
  ): Result<object, {message: string}> => {
22
22
  if (!has_dep(dep_name, package_json)) {
@@ -26,16 +26,22 @@ export const gro_plugin_sveltekit_library = ({
26
26
  svelte_package_options,
27
27
  svelte_package_cli = SVELTE_PACKAGE_CLI,
28
28
  }: Gro_Plugin_Sveltekit_Library_Options = {}): Plugin => {
29
+ const package_json = load_package_json();
30
+
29
31
  return {
30
32
  name: 'gro_plugin_sveltekit_library',
31
33
  setup: async ({dev, log, config}) => {
32
34
  if (!dev) {
33
- await run_svelte_package(svelte_package_options, svelte_package_cli, log, config.pm_cli);
35
+ await run_svelte_package(
36
+ package_json,
37
+ svelte_package_options,
38
+ svelte_package_cli,
39
+ log,
40
+ config.pm_cli,
41
+ );
34
42
  }
35
43
  },
36
44
  adapt: async ({log, timings, config}) => {
37
- const package_json = load_package_json();
38
-
39
45
  // link the CLI binaries if they exist
40
46
  if (package_json.bin) {
41
47
  const timing_to_link = timings.start(`${config.pm_cli} link`);
package/src/lib/loader.ts CHANGED
@@ -193,6 +193,7 @@ export const resolve: ResolveHook = async (specifier, context, nextResolve) => {
193
193
 
194
194
  // Special case for Gro's dependencies that import into Gro.
195
195
  // Without this, we'd need to add a dev dep to Gro for Gro, which causes problems.
196
+ // TODO maybe make this generic, checking `package_json.name` against `s` and map it, possibly need to export `resolve_exported_value`
196
197
  if (IS_THIS_GRO && s.startsWith('@ryanatkn/gro')) {
197
198
  s = join(dir, 'dist', s.substring(13));
198
199
  }
@@ -5,7 +5,7 @@ import type {Src_Json} from './src_json.js';
5
5
 
6
6
  export const package_json = {
7
7
  name: '@ryanatkn/gro',
8
- version: '0.144.1',
8
+ version: '0.145.0',
9
9
  description: 'task runner and toolkit extending SvelteKit',
10
10
  motto: 'generate, run, optimize',
11
11
  glyph: '🌰',
@@ -186,7 +186,6 @@ export const package_json = {
186
186
  './loader.js': {types: './dist/loader.d.ts', default: './dist/loader.js'},
187
187
  './module.js': {types: './dist/module.d.ts', default: './dist/module.js'},
188
188
  './modules.js': {types: './dist/modules.d.ts', default: './dist/modules.js'},
189
- './moss_helpers.js': {types: './dist/moss_helpers.d.ts', default: './dist/moss_helpers.js'},
190
189
  './package_json.js': {types: './dist/package_json.d.ts', default: './dist/package_json.js'},
191
190
  './package_meta.js': {types: './dist/package_meta.d.ts', default: './dist/package_meta.js'},
192
191
  './package.gen.js': {types: './dist/package.gen.d.ts', default: './dist/package.gen.js'},
@@ -271,7 +270,7 @@ export const package_json = {
271
270
 
272
271
  export const src_json = {
273
272
  name: '@ryanatkn/gro',
274
- version: '0.144.1',
273
+ version: '0.145.0',
275
274
  modules: {
276
275
  '.': {
277
276
  path: 'index.ts',
@@ -703,13 +702,6 @@ export const src_json = {
703
702
  {name: 'load_modules', kind: 'function'},
704
703
  ],
705
704
  },
706
- './moss_helpers.js': {
707
- path: 'moss_helpers.ts',
708
- declarations: [
709
- {name: 'MOSS_PACKAGE_DEP_NAME', kind: 'variable'},
710
- {name: 'load_moss_plugin', kind: 'function'},
711
- ],
712
- },
713
705
  './package_json.js': {
714
706
  path: 'package_json.ts',
715
707
  declarations: [
@@ -67,7 +67,9 @@ export const task: Task<Args> = {
67
67
  log.info(st('green', 'dry run!'));
68
68
  }
69
69
 
70
- const has_sveltekit_library_result = has_sveltekit_library();
70
+ const package_json = load_package_json();
71
+
72
+ const has_sveltekit_library_result = has_sveltekit_library(package_json);
71
73
  if (!has_sveltekit_library_result.ok) {
72
74
  throw new Task_Error(
73
75
  'Failed to find SvelteKit library: ' + has_sveltekit_library_result.message,
@@ -109,11 +111,10 @@ export const task: Task<Args> = {
109
111
  if (dry) {
110
112
  log.info('dry run, skipping changeset version');
111
113
  } else {
112
- const package_json_before = load_package_json();
113
- if (typeof package_json_before.version !== 'string') {
114
+ if (typeof package_json.version !== 'string') {
114
115
  throw new Task_Error('Failed to find package.json version');
115
116
  }
116
- const parsed_repo_url = parse_repo_url(package_json_before);
117
+ const parsed_repo_url = parse_repo_url(package_json);
117
118
  if (!parsed_repo_url) {
118
119
  throw new Task_Error(
119
120
  'package.json `repository` must contain a repo url (and GitHub only for now, sorry),' +
@@ -139,9 +140,9 @@ export const task: Task<Args> = {
139
140
  await update_changelog(parsed_repo_url.owner, parsed_repo_url.repo, changelog, token, log);
140
141
  }
141
142
 
142
- const package_json_after = load_package_json();
143
- version = package_json_after.version!;
144
- if (package_json_before.version === version) {
143
+ const package_json_after_versioning = load_package_json();
144
+ version = package_json_after_versioning.version!;
145
+ if (package_json.version === version) {
145
146
  // The version didn't change.
146
147
  // For now this is the best detection we have for a no-op `changeset version`.
147
148
  if (optional) {
@@ -2,6 +2,7 @@ import {z} from 'zod';
2
2
 
3
3
  import type {Task} from './task.js';
4
4
  import {has_sveltekit_library, has_sveltekit_app} from './sveltekit_helpers.js';
5
+ import {load_package_json} from './package_json.js';
5
6
 
6
7
  export const Args = z.object({}).strict();
7
8
  export type Args = z.infer<typeof Args>;
@@ -10,7 +11,9 @@ export const task: Task<Args> = {
10
11
  summary: 'publish and deploy',
11
12
  Args,
12
13
  run: async ({invoke_task}) => {
13
- const publish = has_sveltekit_library().ok;
14
+ const package_json = load_package_json();
15
+
16
+ const publish = has_sveltekit_library(package_json).ok;
14
17
  if (publish) {
15
18
  await invoke_task('publish', {optional: true});
16
19
  }
@@ -15,7 +15,7 @@ export const resolve_node_specifier = (
15
15
  specifier: string,
16
16
  dir = paths.root,
17
17
  parent_path?: string,
18
- cache?: Record<string, Package_Json>,
18
+ package_json_cache?: Record<string, Package_Json>,
19
19
  throw_on_missing_package = true,
20
20
  exports_conditions = DEV ? ['development', 'node', 'import'] : ['production', 'node', 'import'],
21
21
  ): Resolved_Specifier | null => {
@@ -42,10 +42,10 @@ export const resolve_node_specifier = (
42
42
  const subpath = module_path ? './' + module_path : '.';
43
43
  const package_dir = join(dir, NODE_MODULES_DIRNAME, pkg_name);
44
44
 
45
- // Check cache first
45
+ // Check package_json cache first
46
46
  let package_json: Package_Json | undefined;
47
- if (cache?.[pkg_name]) {
48
- package_json = cache[pkg_name];
47
+ if (package_json_cache?.[pkg_name]) {
48
+ package_json = package_json_cache[pkg_name];
49
49
  } else if (!existsSync(package_dir)) {
50
50
  if (throw_on_missing_package) {
51
51
  throw Error(
@@ -56,7 +56,7 @@ export const resolve_node_specifier = (
56
56
  return null;
57
57
  }
58
58
  } else {
59
- package_json = load_package_json(package_dir, cache, false);
59
+ package_json = load_package_json(package_dir, package_json_cache, false);
60
60
  }
61
61
 
62
62
  // Handle self-referencing
@@ -30,7 +30,7 @@ export const has_sveltekit_app = (): Result<object, {message: string}> => {
30
30
  };
31
31
 
32
32
  export const has_sveltekit_library = (
33
- package_json?: Package_Json,
33
+ package_json: Package_Json,
34
34
  sveltekit_config: Parsed_Sveltekit_Config = default_sveltekit_config,
35
35
  dep_name = SVELTE_PACKAGE_DEP_NAME,
36
36
  ): Result<object, {message: string}> => {
@@ -149,12 +149,13 @@ export interface Svelte_Package_Options {
149
149
  }
150
150
 
151
151
  export const run_svelte_package = async (
152
+ package_json: Package_Json,
152
153
  options: Svelte_Package_Options | undefined,
153
154
  cli: string | Cli,
154
155
  log: Logger,
155
156
  pm_cli: string,
156
157
  ): Promise<void> => {
157
- const has_sveltekit_library_result = has_sveltekit_library();
158
+ const has_sveltekit_library_result = has_sveltekit_library(package_json);
158
159
  if (!has_sveltekit_library_result.ok) {
159
160
  throw new Task_Error(
160
161
  'Failed to find SvelteKit library: ' + has_sveltekit_library_result.message,
@@ -1,9 +0,0 @@
1
- import type { Result } from '@ryanatkn/belt/result.js';
2
- import { type Package_Json } from './package_json.js';
3
- export declare const MOSS_PACKAGE_DEP_NAME = "@ryanatkn/moss";
4
- export declare const load_moss_plugin: (package_json?: Package_Json, dep_name?: string, plugin_path?: string, local_plugin_path?: string) => Promise<Result<{
5
- gro_plugin_moss: any;
6
- }, {
7
- message: string;
8
- }>>;
9
- //# sourceMappingURL=moss_helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"moss_helpers.d.ts","sourceRoot":"../src/lib/","sources":["moss_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAIrD,OAAO,EAAU,KAAK,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAG7D,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AAGtD,eAAO,MAAM,gBAAgB,kBACb,YAAY,0EAIzB,OAAO,CAAC,MAAM,CAAC;IAAC,eAAe,EAAE,GAAG,CAAA;CAAC,EAAE;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,CAAC,CA4B3D,CAAC"}
@@ -1,32 +0,0 @@
1
- import { existsSync } from 'node:fs';
2
- import { resolve } from 'node:path';
3
- import { has_dep } from './package_json.js';
4
- import { NODE_MODULES_DIRNAME } from './constants.js';
5
- export const MOSS_PACKAGE_DEP_NAME = '@ryanatkn/moss';
6
- // TODO plugin type?
7
- export const load_moss_plugin = async (package_json, dep_name = MOSS_PACKAGE_DEP_NAME, plugin_path = `${NODE_MODULES_DIRNAME}/${dep_name}/dist/gro_plugin_moss.js`, // TODO maybe lookup from its `package_json.exports`? kinda unnecessary
8
- local_plugin_path = 'src/lib/gro_plugin_moss.ts') => {
9
- if (!has_dep(dep_name, package_json)) {
10
- return {
11
- ok: false,
12
- message: `no dependency found in package.json for ${dep_name}`,
13
- };
14
- }
15
- let path = undefined;
16
- const resolved_local_plugin_path = resolve(local_plugin_path);
17
- if (existsSync(resolved_local_plugin_path)) {
18
- path = resolved_local_plugin_path;
19
- }
20
- if (path === undefined) {
21
- path = resolve(plugin_path);
22
- if (!existsSync(path)) {
23
- return {
24
- ok: false,
25
- // TODO warn?
26
- message: `dependency on ${dep_name} detected but plugin not found at ${path}`,
27
- };
28
- }
29
- }
30
- const mod = await import(path);
31
- return { ok: true, gro_plugin_moss: mod.gro_plugin_moss };
32
- };
@@ -1,44 +0,0 @@
1
- import type {Result} from '@ryanatkn/belt/result.js';
2
- import {existsSync} from 'node:fs';
3
- import {resolve} from 'node:path';
4
-
5
- import {has_dep, type Package_Json} from './package_json.js';
6
- import {NODE_MODULES_DIRNAME} from './constants.js';
7
-
8
- export const MOSS_PACKAGE_DEP_NAME = '@ryanatkn/moss';
9
-
10
- // TODO plugin type?
11
- export const load_moss_plugin = async (
12
- package_json?: Package_Json,
13
- dep_name = MOSS_PACKAGE_DEP_NAME,
14
- plugin_path = `${NODE_MODULES_DIRNAME}/${dep_name}/dist/gro_plugin_moss.js`, // TODO maybe lookup from its `package_json.exports`? kinda unnecessary
15
- local_plugin_path = 'src/lib/gro_plugin_moss.ts',
16
- ): Promise<Result<{gro_plugin_moss: any}, {message: string}>> => {
17
- if (!has_dep(dep_name, package_json)) {
18
- return {
19
- ok: false,
20
- message: `no dependency found in package.json for ${dep_name}`,
21
- };
22
- }
23
-
24
- let path: string | undefined = undefined;
25
-
26
- const resolved_local_plugin_path = resolve(local_plugin_path);
27
- if (existsSync(resolved_local_plugin_path)) {
28
- path = resolved_local_plugin_path;
29
- }
30
-
31
- if (path === undefined) {
32
- path = resolve(plugin_path);
33
- if (!existsSync(path)) {
34
- return {
35
- ok: false,
36
- // TODO warn?
37
- message: `dependency on ${dep_name} detected but plugin not found at ${path}`,
38
- };
39
- }
40
- }
41
-
42
- const mod = await import(path);
43
- return {ok: true, gro_plugin_moss: mod.gro_plugin_moss};
44
- };