@blakearoberts/visage 0.0.5-rc.16 → 0.0.5-rc.18

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":"compose.d.ts","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,CAsD7D"}
1
+ {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,CA6E7D"}
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ import { parse, stringify } from 'yaml';
5
5
  import { spawnSync, spawn } from 'node:child_process';
6
6
  import { hashSync } from 'bcryptjs';
7
7
  import { Eta } from 'eta';
8
+ import { isIP } from 'node:net';
8
9
 
9
10
  const VisageEdgeKeyHeader$1 = 'X-Visage-Edge-Key';
10
11
  const DockerImages = parse(readFileSync(new URL('../docker-compose.images.yml', import.meta.url), 'utf8')).services;
@@ -593,6 +594,29 @@ function startCompose(config) {
593
594
  [config.secrets.cookieSecret]: randomBytes(32).toString('base64url'),
594
595
  };
595
596
  const opts = { cwd: config.cache, env };
597
+ function validate() {
598
+ const args = [
599
+ ...compose,
600
+ 'run',
601
+ '--build',
602
+ '--quiet-build',
603
+ '--rm',
604
+ '--no-deps',
605
+ 'nginx',
606
+ 'nginx',
607
+ '-t',
608
+ '-q',
609
+ ];
610
+ const result = spawnSync('docker', args, {
611
+ ...opts,
612
+ stdio: ['ignore', 'ignore', 'inherit'],
613
+ });
614
+ if (result.error)
615
+ throw result.error;
616
+ if (result.status !== 0) {
617
+ throw new Error('Failed to validate NGINX configuration');
618
+ }
619
+ }
596
620
  function up() {
597
621
  const out = openSync(join(dir, 'compose.log'), 'w');
598
622
  const args = [
@@ -615,6 +639,7 @@ function startCompose(config) {
615
639
  return spawn('docker', args, { ...opts, stdio: ['ignore', out, out] });
616
640
  }
617
641
  down();
642
+ validate();
618
643
  const result = up();
619
644
  if (result.error)
620
645
  throw result.error;
@@ -791,6 +816,7 @@ function renderDexConfig(config) {
791
816
 
792
817
  const template = `
793
818
  load_module modules/ngx_http_js_module.so;
819
+ include /etc/nginx/modules/*.conf;
794
820
 
795
821
  events {}
796
822
 
@@ -986,7 +1012,7 @@ function renderNginxConfig(config) {
986
1012
  ...upstream,
987
1013
  resolve: upstream.host === 'host.docker.internal'
988
1014
  ? process.platform !== 'linux'
989
- : upstream.external,
1015
+ : isIP(upstream.host) === 0,
990
1016
  },
991
1017
  ])),
992
1018
  };
@@ -1 +1 @@
1
- {"version":3,"file":"nginx.d.ts","sourceRoot":"","sources":["../../src/render/nginx.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AA4KnE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAQ3D"}
1
+ {"version":3,"file":"nginx.d.ts","sourceRoot":"","sources":["../../src/render/nginx.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AA6KnE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAQ3D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blakearoberts/visage",
3
- "version": "0.0.5-rc.16",
3
+ "version": "0.0.5-rc.18",
4
4
  "description": "Vite plugin for local development with HMR and OIDC session cookie lifecycle semantics.",
5
5
  "type": "module",
6
6
  "author": "Blake Roberts",