@granite-js/plugin-core 0.1.11 → 0.1.12

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,5 +1,14 @@
1
1
  # @granite-js/plugin-core
2
2
 
3
+ ## 0.1.12
4
+
5
+ ### Patch Changes
6
+
7
+ - d1e6585: fix module resolutions
8
+ - 1e99fe1: support initialScheme, support host
9
+ - Updated dependencies [d1e6585]
10
+ - @granite-js/utils@0.1.12
11
+
3
12
  ## 0.1.11
4
13
 
5
14
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -349,8 +349,8 @@ function writeGraniteGlobalsScript(config) {
349
349
  fs.default.writeFileSync(filePath, script, "utf-8");
350
350
  return filePath;
351
351
  }
352
- function getGraniteGlobalScript({ appName, scheme }) {
353
- return ["global.__granite = global.__granite || {};", `global.__granite.app = { name: ${JSON.stringify(appName)}, scheme: ${JSON.stringify(scheme)} };`].join("\n");
352
+ function getGraniteGlobalScript({ appName, scheme, host }) {
353
+ return ["global.__granite = global.__granite || {};", `global.__granite.app = { name: ${JSON.stringify(appName)}, scheme: ${JSON.stringify(scheme)}, host: ${JSON.stringify(host)} };`].join("\n");
354
354
  }
355
355
 
356
356
  //#endregion
@@ -358,6 +358,7 @@ function getGraniteGlobalScript({ appName, scheme }) {
358
358
  const pluginConfigSchema = zod.object({
359
359
  cwd: zod.string().default(process.cwd()),
360
360
  appName: zod.string(),
361
+ host: zod.string().optional(),
361
362
  scheme: zod.string(),
362
363
  outdir: zod.string().default("dist"),
363
364
  entryFile: zod.string().default("./src/_app.tsx"),
@@ -386,6 +387,7 @@ const pluginConfigSchema = zod.object({
386
387
  * @param config - Configuration options
387
388
  * @param config.cwd - Working directory for build process (defaults to process.cwd())
388
389
  * @param config.appName - Your app's unique identifier
390
+ * @param config.host - Host name for your app (e.g. 'scheme://host/app-name')
389
391
  * @param config.scheme - URL scheme for launching your app (e.g. 'granite')
390
392
  * @param config.outdir - Where to output build files (defaults to 'dist')
391
393
  * @param config.entryFile - Your app's entry point (defaults to './src/_app.tsx')
@@ -408,6 +410,8 @@ const pluginConfigSchema = zod.object({
408
410
  * export default defineConfig({
409
411
  * // The name of your microservice
410
412
  * appName: 'my-app',
413
+ * // (Optional) The host name for your app (e.g. 'scheme://host/app-name')
414
+ * host: 'super',
411
415
  * // The URL scheme for deep linking
412
416
  * scheme: 'granite',
413
417
  * // Entry file path
@@ -421,6 +425,7 @@ const defineConfig = async (config) => {
421
425
  const parsed = pluginConfigSchema.parse(config);
422
426
  const cwd = parsed.cwd ?? (0, __granite_js_utils.getPackageRoot)();
423
427
  const appName = parsed.appName;
428
+ const host = parsed.host ?? "";
424
429
  const scheme = parsed.scheme;
425
430
  const entryFile = path.default.resolve(cwd, parsed.entryFile);
426
431
  const outdir = path.default.join(cwd, parsed.outdir);
@@ -436,7 +441,8 @@ const defineConfig = async (config) => {
436
441
  const globalsScriptConfig = prepareGraniteGlobalsScript({
437
442
  rootDir: cwd,
438
443
  appName,
439
- scheme
444
+ scheme,
445
+ host
440
446
  });
441
447
  const mergedConfig = mergeConfig(parsedConfig, ...[globalsScriptConfig, ...configs].filter(es_toolkit.isNotNil));
442
448
  const { metro, devServer,...build } = mergedConfig ?? {};
package/dist/index.d.cts CHANGED
@@ -564,6 +564,7 @@ declare function mergeBuildConfigs(baseConfig: BuildConfig, ...otherConfigs: Par
564
564
  declare const pluginConfigSchema: z.ZodObject<{
565
565
  cwd: z.ZodDefault<z.ZodString>;
566
566
  appName: z.ZodString;
567
+ host: z.ZodOptional<z.ZodString>;
567
568
  scheme: z.ZodString;
568
569
  outdir: z.ZodDefault<z.ZodString>;
569
570
  entryFile: z.ZodDefault<z.ZodString>;
@@ -627,6 +628,7 @@ declare function isBuildFailure(result: BuildResult$1): result is BuildFailureRe
627
628
  * @param config - Configuration options
628
629
  * @param config.cwd - Working directory for build process (defaults to process.cwd())
629
630
  * @param config.appName - Your app's unique identifier
631
+ * @param config.host - Host name for your app (e.g. 'scheme://host/app-name')
630
632
  * @param config.scheme - URL scheme for launching your app (e.g. 'granite')
631
633
  * @param config.outdir - Where to output build files (defaults to 'dist')
632
634
  * @param config.entryFile - Your app's entry point (defaults to './src/_app.tsx')
@@ -649,6 +651,8 @@ declare function isBuildFailure(result: BuildResult$1): result is BuildFailureRe
649
651
  * export default defineConfig({
650
652
  * // The name of your microservice
651
653
  * appName: 'my-app',
654
+ * // (Optional) The host name for your app (e.g. 'scheme://host/app-name')
655
+ * host: 'super',
652
656
  * // The URL scheme for deep linking
653
657
  * scheme: 'granite',
654
658
  * // Entry file path
package/dist/index.d.ts CHANGED
@@ -564,6 +564,7 @@ declare function mergeBuildConfigs(baseConfig: BuildConfig, ...otherConfigs: Par
564
564
  declare const pluginConfigSchema: z.ZodObject<{
565
565
  cwd: z.ZodDefault<z.ZodString>;
566
566
  appName: z.ZodString;
567
+ host: z.ZodOptional<z.ZodString>;
567
568
  scheme: z.ZodString;
568
569
  outdir: z.ZodDefault<z.ZodString>;
569
570
  entryFile: z.ZodDefault<z.ZodString>;
@@ -627,6 +628,7 @@ declare function isBuildFailure(result: BuildResult$1): result is BuildFailureRe
627
628
  * @param config - Configuration options
628
629
  * @param config.cwd - Working directory for build process (defaults to process.cwd())
629
630
  * @param config.appName - Your app's unique identifier
631
+ * @param config.host - Host name for your app (e.g. 'scheme://host/app-name')
630
632
  * @param config.scheme - URL scheme for launching your app (e.g. 'granite')
631
633
  * @param config.outdir - Where to output build files (defaults to 'dist')
632
634
  * @param config.entryFile - Your app's entry point (defaults to './src/_app.tsx')
@@ -649,6 +651,8 @@ declare function isBuildFailure(result: BuildResult$1): result is BuildFailureRe
649
651
  * export default defineConfig({
650
652
  * // The name of your microservice
651
653
  * appName: 'my-app',
654
+ * // (Optional) The host name for your app (e.g. 'scheme://host/app-name')
655
+ * host: 'super',
652
656
  * // The URL scheme for deep linking
653
657
  * scheme: 'granite',
654
658
  * // Entry file path
package/dist/index.js CHANGED
@@ -326,8 +326,8 @@ function writeGraniteGlobalsScript(config) {
326
326
  fs.writeFileSync(filePath, script, "utf-8");
327
327
  return filePath;
328
328
  }
329
- function getGraniteGlobalScript({ appName, scheme }) {
330
- return ["global.__granite = global.__granite || {};", `global.__granite.app = { name: ${JSON.stringify(appName)}, scheme: ${JSON.stringify(scheme)} };`].join("\n");
329
+ function getGraniteGlobalScript({ appName, scheme, host }) {
330
+ return ["global.__granite = global.__granite || {};", `global.__granite.app = { name: ${JSON.stringify(appName)}, scheme: ${JSON.stringify(scheme)}, host: ${JSON.stringify(host)} };`].join("\n");
331
331
  }
332
332
 
333
333
  //#endregion
@@ -335,6 +335,7 @@ function getGraniteGlobalScript({ appName, scheme }) {
335
335
  const pluginConfigSchema = z.object({
336
336
  cwd: z.string().default(process.cwd()),
337
337
  appName: z.string(),
338
+ host: z.string().optional(),
338
339
  scheme: z.string(),
339
340
  outdir: z.string().default("dist"),
340
341
  entryFile: z.string().default("./src/_app.tsx"),
@@ -363,6 +364,7 @@ const pluginConfigSchema = z.object({
363
364
  * @param config - Configuration options
364
365
  * @param config.cwd - Working directory for build process (defaults to process.cwd())
365
366
  * @param config.appName - Your app's unique identifier
367
+ * @param config.host - Host name for your app (e.g. 'scheme://host/app-name')
366
368
  * @param config.scheme - URL scheme for launching your app (e.g. 'granite')
367
369
  * @param config.outdir - Where to output build files (defaults to 'dist')
368
370
  * @param config.entryFile - Your app's entry point (defaults to './src/_app.tsx')
@@ -385,6 +387,8 @@ const pluginConfigSchema = z.object({
385
387
  * export default defineConfig({
386
388
  * // The name of your microservice
387
389
  * appName: 'my-app',
390
+ * // (Optional) The host name for your app (e.g. 'scheme://host/app-name')
391
+ * host: 'super',
388
392
  * // The URL scheme for deep linking
389
393
  * scheme: 'granite',
390
394
  * // Entry file path
@@ -398,6 +402,7 @@ const defineConfig = async (config) => {
398
402
  const parsed = pluginConfigSchema.parse(config);
399
403
  const cwd = parsed.cwd ?? getPackageRoot();
400
404
  const appName = parsed.appName;
405
+ const host = parsed.host ?? "";
401
406
  const scheme = parsed.scheme;
402
407
  const entryFile = path.resolve(cwd, parsed.entryFile);
403
408
  const outdir = path.join(cwd, parsed.outdir);
@@ -413,7 +418,8 @@ const defineConfig = async (config) => {
413
418
  const globalsScriptConfig = prepareGraniteGlobalsScript({
414
419
  rootDir: cwd,
415
420
  appName,
416
- scheme
421
+ scheme,
422
+ host
417
423
  });
418
424
  const mergedConfig = mergeConfig(parsedConfig, ...[globalsScriptConfig, ...configs].filter(isNotNil));
419
425
  const { metro, devServer,...build } = mergedConfig ?? {};
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.11",
4
+ "version": "0.1.12",
5
5
  "description": "The core plugin module for Granite",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
@@ -9,6 +9,9 @@
9
9
  "typecheck": "tsc --noEmit",
10
10
  "build": "tsdown"
11
11
  },
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
12
15
  "exports": {
13
16
  ".": {
14
17
  "import": {
@@ -31,7 +34,7 @@
31
34
  "vitest": "^3.0.9"
32
35
  },
33
36
  "dependencies": {
34
- "@granite-js/utils": "0.1.11",
37
+ "@granite-js/utils": "0.1.12",
35
38
  "@swc/core": "1.5.24",
36
39
  "@types/babel__core": "^7",
37
40
  "@types/connect": "^3",