@data-fair/dev-server 2.0.24 → 2.2.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.
@@ -14,5 +14,14 @@ export default {
14
14
  __name: 'APP_PROXY_PATHS',
15
15
  __format: 'json'
16
16
  },
17
+ },
18
+ site: {
19
+ primaryColor: 'SITE_PRIMARY_COLOR'
20
+ },
21
+ theme: {
22
+ default: 'THEME_DEFAULT'
23
+ },
24
+ lang: {
25
+ default: 'LANG_DEFAULT'
17
26
  }
18
27
  }
package/config/default.js CHANGED
@@ -13,5 +13,14 @@ export default {
13
13
  url: 'http://localhost:3000',
14
14
  proxyPaths: ['/_nuxt/']
15
15
  },
16
+ site: {
17
+ primaryColor: '#1e88e5'
18
+ },
19
+ theme: {
20
+ default: 'default'
21
+ },
22
+ lang: {
23
+ default: 'fr'
24
+ },
16
25
  serveUi: true
17
26
  }
@@ -17,6 +17,15 @@ export type DevServerConfig = {
17
17
  url: string;
18
18
  proxyPaths: string[];
19
19
  };
20
+ site?: {
21
+ primaryColor?: string;
22
+ };
23
+ theme?: {
24
+ default?: string;
25
+ };
26
+ lang?: {
27
+ default?: string;
28
+ };
20
29
  serveUi?: boolean;
21
30
  }
22
31
 
@@ -4,7 +4,7 @@
4
4
  "use strict";
5
5
  export const validate = validate14;
6
6
  export default validate14;
7
- const schema16 = {"$id":"https://github.com/data-fair/dev-server/config","x-exports":["types","validate"],"x-ajv":{"coerceTypes":"array"},"x-jstt":{"additionalProperties":false},"type":"object","title":"Dev server config","required":["port","dataFair","app"],"properties":{"port":{"type":"number"},"dataFair":{"type":"object","required":["url","owner"],"properties":{"url":{"type":"string"},"owner":{"type":"object","required":["type","id"],"properties":{"type":{"type":"string"},"id":{"type":"string"},"department":{"type":"string"}}},"apiKey":{"type":"string"}}},"app":{"type":"object","required":["url","proxyPaths"],"properties":{"url":{"type":"string"},"proxyPaths":{"type":"array","items":{"type":"string"}}}},"serveUi":{"type":"boolean"}}};
7
+ const schema16 = {"$id":"https://github.com/data-fair/dev-server/config","x-exports":["types","validate"],"x-ajv":{"coerceTypes":"array"},"x-jstt":{"additionalProperties":false},"type":"object","title":"Dev server config","required":["port","dataFair","app"],"properties":{"port":{"type":"number"},"dataFair":{"type":"object","required":["url","owner"],"properties":{"url":{"type":"string"},"owner":{"type":"object","required":["type","id"],"properties":{"type":{"type":"string"},"id":{"type":"string"},"department":{"type":"string"}}},"apiKey":{"type":"string"}}},"app":{"type":"object","required":["url","proxyPaths"],"properties":{"url":{"type":"string"},"proxyPaths":{"type":"array","items":{"type":"string"}}}},"site":{"type":"object","properties":{"primaryColor":{"type":"string"}}},"theme":{"type":"object","properties":{"default":{"type":"string"}}},"lang":{"type":"object","properties":{"default":{"type":"string"}}},"serveUi":{"type":"boolean"}}};
8
8
 
9
9
  function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){
10
10
  /*# sourceURL="https://github.com/data-fair/dev-server/config" */;
@@ -487,27 +487,30 @@ vErrors.push(err20);
487
487
  errors++;
488
488
  }
489
489
  }
490
- if(data.serveUi !== undefined){
491
- let data12 = data.serveUi;
492
- if(typeof data12 !== "boolean"){
493
- let dataType9 = typeof data12;
490
+ if(data.site !== undefined){
491
+ let data12 = data.site;
492
+ if(data12 && typeof data12 == "object" && !Array.isArray(data12)){
493
+ if(data12.primaryColor !== undefined){
494
+ let data13 = data12.primaryColor;
495
+ if(typeof data13 !== "string"){
496
+ let dataType9 = typeof data13;
494
497
  let coerced9 = undefined;
495
- if(dataType9 == 'object' && Array.isArray(data12) && data12.length == 1){
496
- data12 = data12[0];
497
- dataType9 = typeof data12;
498
- if(typeof data12 === "boolean"){
499
- coerced9 = data12;
498
+ if(dataType9 == 'object' && Array.isArray(data13) && data13.length == 1){
499
+ data13 = data13[0];
500
+ dataType9 = typeof data13;
501
+ if(typeof data13 === "string"){
502
+ coerced9 = data13;
500
503
  }
501
504
  }
502
505
  if(!(coerced9 !== undefined)){
503
- if(data12 === "false" || data12 === 0 || data12 === null){
504
- coerced9 = false;
506
+ if(dataType9 == "number" || dataType9 == "boolean"){
507
+ coerced9 = "" + data13;
505
508
  }
506
- else if(data12 === "true" || data12 === 1){
507
- coerced9 = true;
509
+ else if(data13 === null){
510
+ coerced9 = "";
508
511
  }
509
512
  else {
510
- const err21 = {instancePath:instancePath+"/serveUi",schemaPath:"#/properties/serveUi/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
513
+ const err21 = {instancePath:instancePath+"/site/primaryColor",schemaPath:"#/properties/site/properties/primaryColor/type",keyword:"type",params:{type: "string"},message:"must be string"};
511
514
  if(vErrors === null){
512
515
  vErrors = [err21];
513
516
  }
@@ -518,16 +521,16 @@ errors++;
518
521
  }
519
522
  }
520
523
  if(coerced9 !== undefined){
521
- data12 = coerced9;
522
- if(data !== undefined){
523
- data["serveUi"] = coerced9;
524
+ data13 = coerced9;
525
+ if(data12 !== undefined){
526
+ data12["primaryColor"] = coerced9;
524
527
  }
525
528
  }
526
529
  }
527
530
  }
528
531
  }
529
532
  else {
530
- const err22 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
533
+ const err22 = {instancePath:instancePath+"/site",schemaPath:"#/properties/site/type",keyword:"type",params:{type: "object"},message:"must be object"};
531
534
  if(vErrors === null){
532
535
  vErrors = [err22];
533
536
  }
@@ -536,6 +539,162 @@ vErrors.push(err22);
536
539
  }
537
540
  errors++;
538
541
  }
542
+ }
543
+ if(data.theme !== undefined){
544
+ let data14 = data.theme;
545
+ if(data14 && typeof data14 == "object" && !Array.isArray(data14)){
546
+ if(data14.default !== undefined){
547
+ let data15 = data14.default;
548
+ if(typeof data15 !== "string"){
549
+ let dataType10 = typeof data15;
550
+ let coerced10 = undefined;
551
+ if(dataType10 == 'object' && Array.isArray(data15) && data15.length == 1){
552
+ data15 = data15[0];
553
+ dataType10 = typeof data15;
554
+ if(typeof data15 === "string"){
555
+ coerced10 = data15;
556
+ }
557
+ }
558
+ if(!(coerced10 !== undefined)){
559
+ if(dataType10 == "number" || dataType10 == "boolean"){
560
+ coerced10 = "" + data15;
561
+ }
562
+ else if(data15 === null){
563
+ coerced10 = "";
564
+ }
565
+ else {
566
+ const err23 = {instancePath:instancePath+"/theme/default",schemaPath:"#/properties/theme/properties/default/type",keyword:"type",params:{type: "string"},message:"must be string"};
567
+ if(vErrors === null){
568
+ vErrors = [err23];
569
+ }
570
+ else {
571
+ vErrors.push(err23);
572
+ }
573
+ errors++;
574
+ }
575
+ }
576
+ if(coerced10 !== undefined){
577
+ data15 = coerced10;
578
+ if(data14 !== undefined){
579
+ data14["default"] = coerced10;
580
+ }
581
+ }
582
+ }
583
+ }
584
+ }
585
+ else {
586
+ const err24 = {instancePath:instancePath+"/theme",schemaPath:"#/properties/theme/type",keyword:"type",params:{type: "object"},message:"must be object"};
587
+ if(vErrors === null){
588
+ vErrors = [err24];
589
+ }
590
+ else {
591
+ vErrors.push(err24);
592
+ }
593
+ errors++;
594
+ }
595
+ }
596
+ if(data.lang !== undefined){
597
+ let data16 = data.lang;
598
+ if(data16 && typeof data16 == "object" && !Array.isArray(data16)){
599
+ if(data16.default !== undefined){
600
+ let data17 = data16.default;
601
+ if(typeof data17 !== "string"){
602
+ let dataType11 = typeof data17;
603
+ let coerced11 = undefined;
604
+ if(dataType11 == 'object' && Array.isArray(data17) && data17.length == 1){
605
+ data17 = data17[0];
606
+ dataType11 = typeof data17;
607
+ if(typeof data17 === "string"){
608
+ coerced11 = data17;
609
+ }
610
+ }
611
+ if(!(coerced11 !== undefined)){
612
+ if(dataType11 == "number" || dataType11 == "boolean"){
613
+ coerced11 = "" + data17;
614
+ }
615
+ else if(data17 === null){
616
+ coerced11 = "";
617
+ }
618
+ else {
619
+ const err25 = {instancePath:instancePath+"/lang/default",schemaPath:"#/properties/lang/properties/default/type",keyword:"type",params:{type: "string"},message:"must be string"};
620
+ if(vErrors === null){
621
+ vErrors = [err25];
622
+ }
623
+ else {
624
+ vErrors.push(err25);
625
+ }
626
+ errors++;
627
+ }
628
+ }
629
+ if(coerced11 !== undefined){
630
+ data17 = coerced11;
631
+ if(data16 !== undefined){
632
+ data16["default"] = coerced11;
633
+ }
634
+ }
635
+ }
636
+ }
637
+ }
638
+ else {
639
+ const err26 = {instancePath:instancePath+"/lang",schemaPath:"#/properties/lang/type",keyword:"type",params:{type: "object"},message:"must be object"};
640
+ if(vErrors === null){
641
+ vErrors = [err26];
642
+ }
643
+ else {
644
+ vErrors.push(err26);
645
+ }
646
+ errors++;
647
+ }
648
+ }
649
+ if(data.serveUi !== undefined){
650
+ let data18 = data.serveUi;
651
+ if(typeof data18 !== "boolean"){
652
+ let dataType12 = typeof data18;
653
+ let coerced12 = undefined;
654
+ if(dataType12 == 'object' && Array.isArray(data18) && data18.length == 1){
655
+ data18 = data18[0];
656
+ dataType12 = typeof data18;
657
+ if(typeof data18 === "boolean"){
658
+ coerced12 = data18;
659
+ }
660
+ }
661
+ if(!(coerced12 !== undefined)){
662
+ if(data18 === "false" || data18 === 0 || data18 === null){
663
+ coerced12 = false;
664
+ }
665
+ else if(data18 === "true" || data18 === 1){
666
+ coerced12 = true;
667
+ }
668
+ else {
669
+ const err27 = {instancePath:instancePath+"/serveUi",schemaPath:"#/properties/serveUi/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"};
670
+ if(vErrors === null){
671
+ vErrors = [err27];
672
+ }
673
+ else {
674
+ vErrors.push(err27);
675
+ }
676
+ errors++;
677
+ }
678
+ }
679
+ if(coerced12 !== undefined){
680
+ data18 = coerced12;
681
+ if(data !== undefined){
682
+ data["serveUi"] = coerced12;
683
+ }
684
+ }
685
+ }
686
+ }
687
+ }
688
+ else {
689
+ const err28 = {instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"};
690
+ if(vErrors === null){
691
+ vErrors = [err28];
692
+ }
693
+ else {
694
+ vErrors.push(err28);
695
+ }
696
+ errors++;
697
+ }
539
698
  validate14.errors = vErrors;
540
699
  return errors === 0;
541
700
  }
@@ -63,6 +63,30 @@ export default {
63
63
  }
64
64
  }
65
65
  },
66
+ site: {
67
+ type: 'object',
68
+ properties: {
69
+ primaryColor: {
70
+ type: 'string'
71
+ }
72
+ }
73
+ },
74
+ theme: {
75
+ type: 'object',
76
+ properties: {
77
+ default: {
78
+ type: 'string'
79
+ }
80
+ }
81
+ },
82
+ lang: {
83
+ type: 'object',
84
+ properties: {
85
+ default: {
86
+ type: 'string'
87
+ }
88
+ }
89
+ },
66
90
  serveUi: {
67
91
  type: 'boolean'
68
92
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/dev-server",
3
- "version": "2.0.24",
3
+ "version": "2.2.0",
4
4
  "description": "A development server for optimal development experience of data-fair applications.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -13,6 +13,7 @@
13
13
  "dev": "NODE_ENV=development node --watch src/index.js",
14
14
  "dev-test-app-minimal": "http-server test-apps/minimal --port=3000 --cors --silent",
15
15
  "dev-test-app-vue3": "cd test-apps/vue3 && npm run dev",
16
+ "dev-test-app-modern": "cd test-apps/modern && npm run dev",
16
17
  "dev-zellij": "zellij --layout .zellij.kdl",
17
18
  "prepublishOnly": "npm run lint && npm run build && npm -w ui run build",
18
19
  "lint": "eslint . && npm -w ui run lint",
@@ -37,34 +38,34 @@
37
38
  },
38
39
  "homepage": "https://github.com/koumoul-dev/df-dev-server#readme",
39
40
  "devDependencies": {
40
- "@data-fair/lib-types-builder": "^1.8.2",
41
- "@types/config": "^3.3.5",
41
+ "@data-fair/lib-types-builder": "^1.14.0",
42
+ "@types/config": "^4.4.0",
42
43
  "@types/cors": "^2.8.19",
43
- "@types/debug": "^4.1.12",
44
- "@types/express": "^5.0.3",
45
- "@types/node": "^24.0.7",
44
+ "@types/debug": "^4.1.13",
45
+ "@types/express": "^5.0.6",
46
+ "@types/node": "^26.1.0",
46
47
  "@types/ws": "^8.18.1",
47
- "eslint": "^9.30.0",
48
- "eslint-plugin-vue": "^10.2.0",
49
- "eslint-plugin-vuetify": "^2.5.2",
48
+ "eslint": "^9.35.0",
49
+ "eslint-plugin-vue": "^10.9.2",
50
+ "eslint-plugin-vuetify": "^2.7.2",
50
51
  "http-server": "^14.1.1",
51
- "neostandard": "^0.12.1",
52
+ "neostandard": "^0.13.0",
52
53
  "typescript": "^5.8.3"
53
54
  },
54
55
  "dependencies": {
55
- "@data-fair/lib-express": "^1.20.4",
56
- "@parse5/tools": "^0.6.0",
57
- "chalk": "^5.4.1",
58
- "config": "^4.0.0",
59
- "cors": "^2.8.5",
60
- "debug": "^4.4.1",
61
- "dotenv": "^17.0.0",
56
+ "@data-fair/lib-express": "^1.23.1",
57
+ "@parse5/tools": "^0.7.0",
58
+ "chalk": "^5.6.2",
59
+ "config": "^4.4.2",
60
+ "cors": "^2.8.6",
61
+ "debug": "^4.4.3",
62
+ "dotenv": "^17.4.2",
62
63
  "escape-string-regexp": "^5.0.0",
63
- "express": "^5.1.0",
64
- "http-proxy-middleware": "^3.0.5",
65
- "parse5": "^7.3.0",
64
+ "express": "^5.2.1",
65
+ "http-proxy-middleware": "^4.2.0",
66
+ "parse5": "^8.0.1",
66
67
  "prom-client": "^15.1.3",
67
- "ws": "^8.18.3"
68
+ "ws": "^8.21.0"
68
69
  },
69
70
  "files": [
70
71
  "./config/**/*.js",
package/src/app.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const run: () => Promise<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>>;
1
+ export declare const run: () => Promise<import("node:http").Server<typeof import("node:http").IncomingMessage, typeof import("node:http").ServerResponse>>;
2
2
  export declare const stop: () => Promise<void>;
package/src/app.js CHANGED
@@ -183,12 +183,13 @@ app.use('/app', createProxyMiddleware({
183
183
  meta[name] = content;
184
184
  }
185
185
  }
186
- if (meta['df:sync-state'] === 'true' || meta['df:overflow'] === 'true') {
187
- bodyNode.childNodes.push(createElement('script', {
188
- type: 'text/javascript',
189
- src: 'https://cdn.jsdelivr.net/npm/@data-fair/frame@0.12/dist/v-iframe-compat/d-frame-content.min.js'
190
- }));
191
- }
186
+ // companion script that lets the embedded app report its height / sync params
187
+ // to the parent <d-frame> ; injected for every mode so the UI mode toggle works
188
+ // without requiring a df:overflow meta (same variant & version as data-fair prod)
189
+ bodyNode.childNodes.push(createElement('script', {
190
+ type: 'text/javascript',
191
+ src: 'https://cdn.jsdelivr.net/npm/@data-fair/frame@0.18/dist/v-iframe-compat/d-frame-content.min.js'
192
+ }));
192
193
  output = parse5.serialize(document);
193
194
  // proxyRes.headers['content-length'] = output.length
194
195
  delete proxyRes.headers['content-length'];
package/src/index.js CHANGED
File without changes
@@ -8,6 +8,15 @@ export declare const uiConfig: {
8
8
  };
9
9
  apiKey?: string;
10
10
  };
11
+ site: {
12
+ primaryColor?: string;
13
+ } | undefined;
14
+ theme: {
15
+ default?: string;
16
+ } | undefined;
17
+ lang: {
18
+ default?: string;
19
+ } | undefined;
11
20
  };
12
21
  export type UiConfig = typeof uiConfig;
13
22
  export default uiConfig;
package/src/ui-config.js CHANGED
@@ -1,3 +1,8 @@
1
1
  import config from './config.js';
2
- export const uiConfig = { dataFair: config.dataFair };
2
+ export const uiConfig = {
3
+ dataFair: config.dataFair,
4
+ site: config.site,
5
+ theme: config.theme,
6
+ lang: config.lang
7
+ };
3
8
  export default uiConfig;