@granite-js/plugin-core 0.1.33 → 1.0.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.
package/CHANGELOG.md CHANGED
@@ -1,222 +1,12 @@
1
1
  # @granite-js/plugin-core
2
2
 
3
- ## 0.1.33
3
+ ## 1.0.0
4
4
 
5
- ### Patch Changes
6
-
7
- - @granite-js/utils@0.1.33
8
-
9
- ## 0.1.32
10
-
11
- ### Patch Changes
12
-
13
- - 7572713: bump version up babel
14
- - @granite-js/utils@0.1.32
15
-
16
- ## 0.1.31
17
-
18
- ### Patch Changes
19
-
20
- - 9bf8b50: expose resolveRequest option
21
- - e957833: expose `resolver.resolverMainFields` and `resolver.unstable_conditionNames` options
22
- - @granite-js/utils@0.1.31
23
-
24
- ## 0.1.30
25
-
26
- ### Patch Changes
27
-
28
- - @granite-js/utils@0.1.30
29
-
30
- ## 0.1.29
31
-
32
- ### Patch Changes
33
-
34
- - ed4cdbf: support additional metro config options from granite.config.ts
35
- - @granite-js/utils@0.1.29
36
-
37
- ## 0.1.28
38
-
39
- ### Patch Changes
40
-
41
- - 1d958cc: ci: provenance
42
- - Updated dependencies [1d958cc]
43
- - @granite-js/utils@0.1.28
44
-
45
- ## 0.1.27
46
-
47
- ### Patch Changes
48
-
49
- - e32b020: ci: oidc
50
- - Updated dependencies [e32b020]
51
- - @granite-js/utils@0.1.27
52
-
53
- ## 0.1.26
54
-
55
- ### Patch Changes
56
-
57
- - @granite-js/utils@0.1.26
58
-
59
- ## 0.1.25
60
-
61
- ### Patch Changes
62
-
63
- - @granite-js/utils@0.1.25
64
-
65
- ## 0.1.24
66
-
67
- ### Patch Changes
68
-
69
- - 6e42c3d: add inspectorProxy options
70
- - @granite-js/utils@0.1.24
71
-
72
- ## 0.1.23
73
-
74
- ### Patch Changes
75
-
76
- - @granite-js/utils@0.1.23
77
-
78
- ## 0.1.22
79
-
80
- ### Patch Changes
81
-
82
- - @granite-js/utils@0.1.22
83
-
84
- ## 0.1.21
85
-
86
- ### Patch Changes
87
-
88
- - @granite-js/utils@0.1.21
89
-
90
- ## 0.1.20
91
-
92
- ### Patch Changes
93
-
94
- - @granite-js/utils@0.1.20
95
-
96
- ## 0.1.19
97
-
98
- ### Patch Changes
99
-
100
- - e9a3daf: missing Metro configuration compatibility
101
- - @granite-js/utils@0.1.19
102
-
103
- ## 0.1.18
104
-
105
- ### Patch Changes
106
-
107
- - @granite-js/utils@0.1.18
108
-
109
- ## 0.1.17
110
-
111
- ### Patch Changes
112
-
113
- - 9c415df: supports dynamic plugin config
114
- - @granite-js/utils@0.1.17
115
-
116
- ## 0.1.16
117
-
118
- ### Patch Changes
119
-
120
- - @granite-js/utils@0.1.16
121
-
122
- ## 0.1.15
123
-
124
- ### Patch Changes
125
-
126
- - d16ee87: Add useInitialProps, useInitialSearchParams hook.
127
- - Updated dependencies [d16ee87]
128
- - @granite-js/utils@0.1.15
129
-
130
- ## 0.1.14
131
-
132
- ### Patch Changes
133
-
134
- - @granite-js/utils@0.1.14
135
-
136
- ## 0.1.13
137
-
138
- ### Patch Changes
139
-
140
- - @granite-js/utils@0.1.13
141
-
142
- ## 0.1.12
143
-
144
- ### Patch Changes
145
-
146
- - d1e6585: fix module resolutions
147
- - 1e99fe1: support initialScheme, support host
148
- - Updated dependencies [d1e6585]
149
- - @granite-js/utils@0.1.12
150
-
151
- ## 0.1.11
152
-
153
- ### Patch Changes
154
-
155
- - d3a2b58: improve resolver plugin
156
- - @granite-js/utils@0.1.11
157
-
158
- ## 0.1.10
159
-
160
- ### Patch Changes
161
-
162
- - 9438be5: add dynamic config support
163
- - @granite-js/utils@0.1.10
164
-
165
- ## 0.1.9
166
-
167
- ### Patch Changes
168
-
169
- - 935bb36: fix `BuildUtils` errors and incorrect plugin types
170
-
171
- ## 0.1.8
172
-
173
- ### Patch Changes
174
-
175
- - b69366c: improve config structure
176
-
177
- ## 0.1.7
178
-
179
- ## 0.1.6
180
-
181
- ## 0.1.5
182
-
183
- ## 0.1.4
184
-
185
- ## 0.1.3
186
-
187
- ## 0.1.2
188
-
189
- ## 0.1.1
190
-
191
- ### Patch Changes
192
-
193
- - d675415: Improve scaffolding to provide a better showcase UI
194
- - 10a5f3f: empty
195
-
196
- ## 0.1.0
197
-
198
- ### Minor Changes
199
-
200
- - 561a3ed: fix: docs deadlink
201
-
202
- ## 0.0.3
203
-
204
- ### Patch Changes
205
-
206
- - ed4d356: changeset
5
+ ### Major Changes
207
6
 
208
- ## 0.0.2
7
+ - 260daab: feat: introduce support react native 0.84
209
8
 
210
9
  ### Patch Changes
211
10
 
212
- - 0ae09b7: deploy guide
213
- - 0ae09b7: type fix
214
- - 0ae09b7: guide
215
- - 0ae09b7: showcase
216
- - 0ae09b7: refactor interface names
217
- - 0ae09b7: plugin-router
218
- - 0ae09b7: CanGoBackGuard 수정, typecheck fix, lint fix
219
- - 0ae09b7: counter
220
- - 0ae09b7: licenses
221
- - 0ae09b7: - Add plugin context to allow plugins to share data
222
- - Implement Hermes plugin to compile Hermes bytecode and compose source maps
11
+ - Updated dependencies [260daab]
12
+ - @granite-js/utils@1.0.0
package/dist/index.cjs CHANGED
@@ -1,4 +1,5 @@
1
- //#region rolldown:runtime
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ //#region \0rolldown/runtime.js
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -6,12 +7,16 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __getProtoOf = Object.getPrototypeOf;
7
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
9
  var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) {
14
+ __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ }
15
20
  }
16
21
  return to;
17
22
  };
@@ -24,7 +29,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
29
  let es_toolkit = require("es-toolkit");
25
30
  let path = require("path");
26
31
  path = __toESM(path);
27
- let __granite_js_utils = require("@granite-js/utils");
32
+ let _granite_js_utils = require("@granite-js/utils");
28
33
  let fs = require("fs");
29
34
  fs = __toESM(fs);
30
35
  let zod = require("zod");
@@ -256,7 +261,8 @@ async function mergeConfig(base, ...configs) {
256
261
  swc: mergeSwc(resolvedAcc?.swc, resolvedCurr?.swc),
257
262
  devServer: mergeDevServer(resolvedAcc?.devServer, resolvedCurr?.devServer),
258
263
  metro: mergeMetro(resolvedAcc?.metro, resolvedCurr?.metro),
259
- extra: mergeExtra(resolvedAcc?.extra, resolvedCurr?.extra)
264
+ extra: mergeExtra(resolvedAcc?.extra, resolvedCurr?.extra),
265
+ reactNativePath: resolvedCurr.reactNativePath ?? resolvedAcc.reactNativePath
260
266
  };
261
267
  }, resolveDynamicConfig(base));
262
268
  }
@@ -351,6 +357,7 @@ async function resolveConfig(config) {
351
357
  function resolveMetroConfig(pluginConfig) {
352
358
  return {
353
359
  ...pluginConfig.metro ?? {},
360
+ reactNativePath: pluginConfig.reactNativePath,
354
361
  babelConfig: pluginConfig.babel,
355
362
  transformSync: pluginConfig?.transformer?.transformSync
356
363
  };
@@ -367,8 +374,8 @@ function prepareGraniteGlobalsScript(config) {
367
374
  }
368
375
  function writeGraniteGlobalsScript(config) {
369
376
  const script = getGraniteGlobalScript(config);
370
- const filePath = path.default.join((0, __granite_js_utils.getLocalTempDirectoryPath)(config.rootDir), "granite-globals.js");
371
- (0, __granite_js_utils.prepareLocalDirectory)(config.rootDir);
377
+ const filePath = path.default.join((0, _granite_js_utils.getLocalTempDirectoryPath)(config.rootDir), "granite-globals.js");
378
+ (0, _granite_js_utils.prepareLocalDirectory)(config.rootDir);
372
379
  fs.default.writeFileSync(filePath, script, "utf-8");
373
380
  return filePath;
374
381
  }
@@ -388,7 +395,8 @@ const pluginConfigSchema = zod.object({
388
395
  build: zod.custom().optional(),
389
396
  devServer: zod.custom().optional(),
390
397
  metro: zod.custom().optional(),
391
- plugins: zod.custom()
398
+ plugins: zod.custom(),
399
+ reactNativePath: zod.string().optional()
392
400
  });
393
401
 
394
402
  //#endregion
@@ -418,6 +426,7 @@ const pluginConfigSchema = zod.object({
418
426
  * @param config.metro - Configure Metro bundler settings
419
427
  * @param config.devServer - Configure Mpack dev server settings
420
428
  * @param config.plugins - Granite plugins to enhance functionality
429
+ * @param config.reactNativePath - Path to `react-native` directory (defaults to project's `react-native` package path)
421
430
  * @returns The processed configuration
422
431
  *
423
432
  * @example
@@ -446,7 +455,7 @@ const pluginConfigSchema = zod.object({
446
455
  */
447
456
  const defineConfig = async (config) => {
448
457
  const parsed = pluginConfigSchema.parse(config);
449
- const cwd = parsed.cwd ?? (0, __granite_js_utils.getPackageRoot)();
458
+ const cwd = parsed.cwd ?? (0, _granite_js_utils.getPackageRoot)();
450
459
  const appName = parsed.appName;
451
460
  const host = parsed.host ?? "";
452
461
  const scheme = parsed.scheme;
@@ -476,7 +485,8 @@ const defineConfig = async (config) => {
476
485
  host
477
486
  }),
478
487
  ...configs
479
- ].filter(es_toolkit.isNotNil)
488
+ ].filter(es_toolkit.isNotNil),
489
+ reactNativePath: parsed.reactNativePath
480
490
  };
481
491
  };
482
492
 
@@ -485,7 +495,7 @@ const defineConfig = async (config) => {
485
495
  const MODULE_NAME = "granite";
486
496
  const loadConfig = async (options = {}) => {
487
497
  let result;
488
- const resolveRoot = options.root ?? (0, __granite_js_utils.getPackageRoot)();
498
+ const resolveRoot = options.root ?? (0, _granite_js_utils.getPackageRoot)();
489
499
  if (options.configFile) result = await getConfigExplorer().load(path.default.resolve(resolveRoot, options.configFile));
490
500
  else result = await getConfigExplorer({ searchPlaces: [
491
501
  `${MODULE_NAME}.config.ts`,
package/dist/index.d.cts CHANGED
@@ -73,6 +73,10 @@ interface BuildConfig {
73
73
  * ```
74
74
  */
75
75
  extra?: any;
76
+ /**
77
+ * Path to `react-native` package path
78
+ */
79
+ reactNativePath?: string;
76
80
  }
77
81
  interface ResolverConfig {
78
82
  /**
@@ -487,6 +491,7 @@ interface AdditionalMetroConfig extends MetroConfig {
487
491
  babelConfig?: babel.TransformOptions;
488
492
  transformSync?: (id: string, code: string) => string;
489
493
  projectRoot?: MetroConfig['projectRoot'];
494
+ reactNativePath?: string;
490
495
  }
491
496
  //#endregion
492
497
  //#region src/types/GranitePlugin.d.ts
@@ -597,6 +602,7 @@ declare const pluginConfigSchema: z.ZodObject<{
597
602
  devServer: z.ZodOptional<z.ZodCustom<DevServerConfig, DevServerConfig>>;
598
603
  metro: z.ZodOptional<z.ZodCustom<AdditionalMetroConfig & MetroDevServerConfig, AdditionalMetroConfig & MetroDevServerConfig>>;
599
604
  plugins: z.ZodCustom<PluginInput, PluginInput>;
605
+ reactNativePath: z.ZodOptional<z.ZodString>;
600
606
  }, z.core.$strip>;
601
607
  type GraniteConfig = z.input<typeof pluginConfigSchema>;
602
608
  type ParsedGraniteConfig = z.output<typeof pluginConfigSchema>;
@@ -607,6 +613,7 @@ type CompleteGraniteConfig = {
607
613
  outdir: ParsedGraniteConfig['outdir'];
608
614
  pluginHooks: GranitePluginHooks;
609
615
  pluginConfigs: PluginConfig[];
616
+ reactNativePath?: string;
610
617
  };
611
618
  interface GranitePluginHooks {
612
619
  devServer: {
@@ -665,6 +672,7 @@ declare function resolveConfig(config: CompleteGraniteConfig): Promise<ResolvedP
665
672
  * @param config.metro - Configure Metro bundler settings
666
673
  * @param config.devServer - Configure Mpack dev server settings
667
674
  * @param config.plugins - Granite plugins to enhance functionality
675
+ * @param config.reactNativePath - Path to `react-native` directory (defaults to project's `react-native` package path)
668
676
  * @returns The processed configuration
669
677
  *
670
678
  * @example
package/dist/index.d.ts CHANGED
@@ -73,6 +73,10 @@ interface BuildConfig {
73
73
  * ```
74
74
  */
75
75
  extra?: any;
76
+ /**
77
+ * Path to `react-native` package path
78
+ */
79
+ reactNativePath?: string;
76
80
  }
77
81
  interface ResolverConfig {
78
82
  /**
@@ -487,6 +491,7 @@ interface AdditionalMetroConfig extends MetroConfig {
487
491
  babelConfig?: babel.TransformOptions;
488
492
  transformSync?: (id: string, code: string) => string;
489
493
  projectRoot?: MetroConfig['projectRoot'];
494
+ reactNativePath?: string;
490
495
  }
491
496
  //#endregion
492
497
  //#region src/types/GranitePlugin.d.ts
@@ -597,6 +602,7 @@ declare const pluginConfigSchema: z.ZodObject<{
597
602
  devServer: z.ZodOptional<z.ZodCustom<DevServerConfig, DevServerConfig>>;
598
603
  metro: z.ZodOptional<z.ZodCustom<AdditionalMetroConfig & MetroDevServerConfig, AdditionalMetroConfig & MetroDevServerConfig>>;
599
604
  plugins: z.ZodCustom<PluginInput, PluginInput>;
605
+ reactNativePath: z.ZodOptional<z.ZodString>;
600
606
  }, z.core.$strip>;
601
607
  type GraniteConfig = z.input<typeof pluginConfigSchema>;
602
608
  type ParsedGraniteConfig = z.output<typeof pluginConfigSchema>;
@@ -607,6 +613,7 @@ type CompleteGraniteConfig = {
607
613
  outdir: ParsedGraniteConfig['outdir'];
608
614
  pluginHooks: GranitePluginHooks;
609
615
  pluginConfigs: PluginConfig[];
616
+ reactNativePath?: string;
610
617
  };
611
618
  interface GranitePluginHooks {
612
619
  devServer: {
@@ -665,6 +672,7 @@ declare function resolveConfig(config: CompleteGraniteConfig): Promise<ResolvedP
665
672
  * @param config.metro - Configure Metro bundler settings
666
673
  * @param config.devServer - Configure Mpack dev server settings
667
674
  * @param config.plugins - Granite plugins to enhance functionality
675
+ * @param config.reactNativePath - Path to `react-native` directory (defaults to project's `react-native` package path)
668
676
  * @returns The processed configuration
669
677
  *
670
678
  * @example
package/dist/index.js CHANGED
@@ -230,7 +230,8 @@ async function mergeConfig(base, ...configs) {
230
230
  swc: mergeSwc(resolvedAcc?.swc, resolvedCurr?.swc),
231
231
  devServer: mergeDevServer(resolvedAcc?.devServer, resolvedCurr?.devServer),
232
232
  metro: mergeMetro(resolvedAcc?.metro, resolvedCurr?.metro),
233
- extra: mergeExtra(resolvedAcc?.extra, resolvedCurr?.extra)
233
+ extra: mergeExtra(resolvedAcc?.extra, resolvedCurr?.extra),
234
+ reactNativePath: resolvedCurr.reactNativePath ?? resolvedAcc.reactNativePath
234
235
  };
235
236
  }, resolveDynamicConfig(base));
236
237
  }
@@ -325,6 +326,7 @@ async function resolveConfig(config) {
325
326
  function resolveMetroConfig(pluginConfig) {
326
327
  return {
327
328
  ...pluginConfig.metro ?? {},
329
+ reactNativePath: pluginConfig.reactNativePath,
328
330
  babelConfig: pluginConfig.babel,
329
331
  transformSync: pluginConfig?.transformer?.transformSync
330
332
  };
@@ -362,7 +364,8 @@ const pluginConfigSchema = z.object({
362
364
  build: z.custom().optional(),
363
365
  devServer: z.custom().optional(),
364
366
  metro: z.custom().optional(),
365
- plugins: z.custom()
367
+ plugins: z.custom(),
368
+ reactNativePath: z.string().optional()
366
369
  });
367
370
 
368
371
  //#endregion
@@ -392,6 +395,7 @@ const pluginConfigSchema = z.object({
392
395
  * @param config.metro - Configure Metro bundler settings
393
396
  * @param config.devServer - Configure Mpack dev server settings
394
397
  * @param config.plugins - Granite plugins to enhance functionality
398
+ * @param config.reactNativePath - Path to `react-native` directory (defaults to project's `react-native` package path)
395
399
  * @returns The processed configuration
396
400
  *
397
401
  * @example
@@ -450,7 +454,8 @@ const defineConfig = async (config) => {
450
454
  host
451
455
  }),
452
456
  ...configs
453
- ].filter(isNotNil)
457
+ ].filter(isNotNil),
458
+ reactNativePath: parsed.reactNativePath
454
459
  };
455
460
  };
456
461
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@granite-js/plugin-core",
3
3
  "type": "module",
4
- "version": "0.1.33",
4
+ "version": "1.0.0",
5
5
  "description": "The core plugin module for Granite",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
@@ -34,15 +34,15 @@
34
34
  "dist"
35
35
  ],
36
36
  "devDependencies": {
37
- "@types/node": "^24.3.0",
37
+ "@types/node": "24.10.12",
38
38
  "@vitest/coverage-v8": "^4.0.12",
39
- "tsdown": "^0.16.5",
40
- "typescript": "^5.6.3",
39
+ "tsdown": "0.20.3",
40
+ "typescript": "5.9.3",
41
41
  "vitest": "^4.0.12"
42
42
  },
43
43
  "dependencies": {
44
- "@granite-js/utils": "0.1.33",
45
- "@swc/core": "1.5.24",
44
+ "@granite-js/utils": "1.0.0",
45
+ "@swc/core": "1.15.8",
46
46
  "@types/babel__core": "^7",
47
47
  "@types/connect": "^3",
48
48
  "@types/ws": "^8.18.0",