@valbuild/cli 0.74.0 → 0.75.1
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.
@@ -12,6 +12,7 @@ var fs = require('fs/promises');
|
|
12
12
|
var vm = require('node:vm');
|
13
13
|
var ts = require('typescript');
|
14
14
|
var z = require('zod');
|
15
|
+
var node_module = require('node:module');
|
15
16
|
var fs$1 = require('fs');
|
16
17
|
|
17
18
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
@@ -84,6 +85,7 @@ async function evalValConfigFile(projectRoot, configFileName) {
|
|
84
85
|
},
|
85
86
|
fileName: valConfigPath
|
86
87
|
});
|
88
|
+
const projectRootRequire = node_module.createRequire(projectRoot);
|
87
89
|
const exportsObj = {};
|
88
90
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
89
91
|
const sandbox = {
|
@@ -91,10 +93,10 @@ async function evalValConfigFile(projectRoot, configFileName) {
|
|
91
93
|
module: {
|
92
94
|
exports: exportsObj
|
93
95
|
},
|
94
|
-
require,
|
96
|
+
require: projectRootRequire,
|
95
97
|
// NOTE: this is a security risk, but this code is running in the users own environment at the CLI level
|
96
98
|
__filename: valConfigPath,
|
97
|
-
__dirname:
|
99
|
+
__dirname: projectRoot,
|
98
100
|
console,
|
99
101
|
process
|
100
102
|
};
|
@@ -127,7 +129,7 @@ async function validate({
|
|
127
129
|
noEslint
|
128
130
|
}) {
|
129
131
|
const valRemoteHost = process.env.VAL_REMOTE_HOST || core.DEFAULT_VAL_REMOTE_HOST;
|
130
|
-
const contentHostUrl = process.env.VAL_CONTENT_URL ||
|
132
|
+
const contentHostUrl = process.env.VAL_CONTENT_URL || core.DEFAULT_CONTENT_HOST;
|
131
133
|
const projectRoot = root ? path__default["default"].resolve(root) : process.cwd();
|
132
134
|
const eslint$1 = new eslint.ESLint({
|
133
135
|
cwd: projectRoot,
|
@@ -12,6 +12,7 @@ var fs = require('fs/promises');
|
|
12
12
|
var vm = require('node:vm');
|
13
13
|
var ts = require('typescript');
|
14
14
|
var z = require('zod');
|
15
|
+
var node_module = require('node:module');
|
15
16
|
var fs$1 = require('fs');
|
16
17
|
|
17
18
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
@@ -84,6 +85,7 @@ async function evalValConfigFile(projectRoot, configFileName) {
|
|
84
85
|
},
|
85
86
|
fileName: valConfigPath
|
86
87
|
});
|
88
|
+
const projectRootRequire = node_module.createRequire(projectRoot);
|
87
89
|
const exportsObj = {};
|
88
90
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
89
91
|
const sandbox = {
|
@@ -91,10 +93,10 @@ async function evalValConfigFile(projectRoot, configFileName) {
|
|
91
93
|
module: {
|
92
94
|
exports: exportsObj
|
93
95
|
},
|
94
|
-
require,
|
96
|
+
require: projectRootRequire,
|
95
97
|
// NOTE: this is a security risk, but this code is running in the users own environment at the CLI level
|
96
98
|
__filename: valConfigPath,
|
97
|
-
__dirname:
|
99
|
+
__dirname: projectRoot,
|
98
100
|
console,
|
99
101
|
process
|
100
102
|
};
|
@@ -127,7 +129,7 @@ async function validate({
|
|
127
129
|
noEslint
|
128
130
|
}) {
|
129
131
|
const valRemoteHost = process.env.VAL_REMOTE_HOST || core.DEFAULT_VAL_REMOTE_HOST;
|
130
|
-
const contentHostUrl = process.env.VAL_CONTENT_URL ||
|
132
|
+
const contentHostUrl = process.env.VAL_CONTENT_URL || core.DEFAULT_CONTENT_HOST;
|
131
133
|
const projectRoot = root ? path__default["default"].resolve(root) : process.cwd();
|
132
134
|
const eslint$1 = new eslint.ESLint({
|
133
135
|
cwd: projectRoot,
|
@@ -2,7 +2,7 @@ import meow from 'meow';
|
|
2
2
|
import chalk from 'chalk';
|
3
3
|
import path from 'path';
|
4
4
|
import { createService, getPersonalAccessTokenPath, parsePersonalAccessTokenFile, getSettings, uploadRemoteFile, createFixPatch } from '@valbuild/server';
|
5
|
-
import { DEFAULT_VAL_REMOTE_HOST, Internal, FILE_REF_PROP, VAL_EXTENSION } from '@valbuild/core';
|
5
|
+
import { DEFAULT_VAL_REMOTE_HOST, DEFAULT_CONTENT_HOST, Internal, FILE_REF_PROP, VAL_EXTENSION } from '@valbuild/core';
|
6
6
|
import { glob } from 'fast-glob';
|
7
7
|
import picocolors from 'picocolors';
|
8
8
|
import { ESLint } from 'eslint';
|
@@ -10,6 +10,7 @@ import fs from 'fs/promises';
|
|
10
10
|
import vm from 'node:vm';
|
11
11
|
import ts from 'typescript';
|
12
12
|
import z from 'zod';
|
13
|
+
import { createRequire } from 'node:module';
|
13
14
|
import fs$1 from 'fs';
|
14
15
|
|
15
16
|
function error(message) {
|
@@ -52,6 +53,7 @@ async function evalValConfigFile(projectRoot, configFileName) {
|
|
52
53
|
},
|
53
54
|
fileName: valConfigPath
|
54
55
|
});
|
56
|
+
const projectRootRequire = createRequire(projectRoot);
|
55
57
|
const exportsObj = {};
|
56
58
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
57
59
|
const sandbox = {
|
@@ -59,10 +61,10 @@ async function evalValConfigFile(projectRoot, configFileName) {
|
|
59
61
|
module: {
|
60
62
|
exports: exportsObj
|
61
63
|
},
|
62
|
-
require,
|
64
|
+
require: projectRootRequire,
|
63
65
|
// NOTE: this is a security risk, but this code is running in the users own environment at the CLI level
|
64
66
|
__filename: valConfigPath,
|
65
|
-
__dirname:
|
67
|
+
__dirname: projectRoot,
|
66
68
|
console,
|
67
69
|
process
|
68
70
|
};
|
@@ -95,7 +97,7 @@ async function validate({
|
|
95
97
|
noEslint
|
96
98
|
}) {
|
97
99
|
const valRemoteHost = process.env.VAL_REMOTE_HOST || DEFAULT_VAL_REMOTE_HOST;
|
98
|
-
const contentHostUrl = process.env.VAL_CONTENT_URL ||
|
100
|
+
const contentHostUrl = process.env.VAL_CONTENT_URL || DEFAULT_CONTENT_HOST;
|
99
101
|
const projectRoot = root ? path.resolve(root) : process.cwd();
|
100
102
|
const eslint = new ESLint({
|
101
103
|
cwd: projectRoot,
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@valbuild/cli",
|
3
3
|
"private": false,
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.75.1",
|
5
5
|
"description": "Val CLI tools",
|
6
6
|
"bin": {
|
7
7
|
"val": "./bin.js"
|
@@ -18,9 +18,9 @@
|
|
18
18
|
"typecheck": "tsc --noEmit"
|
19
19
|
},
|
20
20
|
"dependencies": {
|
21
|
-
"@valbuild/core": "~0.
|
22
|
-
"@valbuild/server": "~0.
|
23
|
-
"@valbuild/eslint-plugin": "~0.
|
21
|
+
"@valbuild/core": "~0.75.1",
|
22
|
+
"@valbuild/server": "~0.75.1",
|
23
|
+
"@valbuild/eslint-plugin": "~0.75.1",
|
24
24
|
"eslint": "^8.31.0",
|
25
25
|
"@inquirer/confirm": "^2.0.15",
|
26
26
|
"@inquirer/prompts": "^3.0.2",
|
@@ -4,6 +4,7 @@ import vm from "node:vm";
|
|
4
4
|
import ts from "typescript"; // TODO: make this dependency optional (only required if the file is val.config.ts not val.config.js)
|
5
5
|
import z from "zod";
|
6
6
|
import { ValConfig } from "@valbuild/core";
|
7
|
+
import { createRequire } from "node:module";
|
7
8
|
|
8
9
|
const ValConfigSchema = z.object({
|
9
10
|
project: z.string().optional(),
|
@@ -56,14 +57,15 @@ export async function evalValConfigFile(
|
|
56
57
|
fileName: valConfigPath,
|
57
58
|
});
|
58
59
|
|
60
|
+
const projectRootRequire = createRequire(projectRoot);
|
59
61
|
const exportsObj = {};
|
60
62
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
61
63
|
const sandbox: Record<string, any> = {
|
62
64
|
exports: exportsObj,
|
63
65
|
module: { exports: exportsObj },
|
64
|
-
require, // NOTE: this is a security risk, but this code is running in the users own environment at the CLI level
|
66
|
+
require: projectRootRequire, // NOTE: this is a security risk, but this code is running in the users own environment at the CLI level
|
65
67
|
__filename: valConfigPath,
|
66
|
-
__dirname:
|
68
|
+
__dirname: projectRoot,
|
67
69
|
console,
|
68
70
|
process,
|
69
71
|
};
|
package/src/validate.ts
CHANGED
@@ -8,6 +8,7 @@ import {
|
|
8
8
|
uploadRemoteFile,
|
9
9
|
} from "@valbuild/server";
|
10
10
|
import {
|
11
|
+
DEFAULT_CONTENT_HOST,
|
11
12
|
DEFAULT_VAL_REMOTE_HOST,
|
12
13
|
FILE_REF_PROP,
|
13
14
|
Internal,
|
@@ -36,8 +37,7 @@ export async function validate({
|
|
36
37
|
noEslint?: boolean;
|
37
38
|
}) {
|
38
39
|
const valRemoteHost = process.env.VAL_REMOTE_HOST || DEFAULT_VAL_REMOTE_HOST;
|
39
|
-
const contentHostUrl =
|
40
|
-
process.env.VAL_CONTENT_URL || "https://content.val.build";
|
40
|
+
const contentHostUrl = process.env.VAL_CONTENT_URL || DEFAULT_CONTENT_HOST;
|
41
41
|
const projectRoot = root ? path.resolve(root) : process.cwd();
|
42
42
|
const eslint = new ESLint({
|
43
43
|
cwd: projectRoot,
|