@matter/nodejs
Advanced tools
Comparing version 0.11.4 to 0.11.5-alpha.0-20241108-c38ea9922
@@ -18,4 +18,6 @@ /** | ||
* | ||
* - Via configuration | ||
* - Explicitly (see {@link config}) | ||
* | ||
* - Via configuration (file, command line or system environment variables) | ||
* | ||
* - By modifying {@link Environment.default} | ||
@@ -49,3 +51,3 @@ * | ||
export declare function getDefaults(vars: VariableService): { | ||
environment: "default"; | ||
environment: string; | ||
path: { | ||
@@ -58,4 +60,5 @@ root: string; | ||
exitcode: boolean; | ||
unhandlederrors: boolean; | ||
}; | ||
}; | ||
//# sourceMappingURL=NodeJsEnvironment.d.ts.map |
@@ -26,2 +26,3 @@ "use strict"; | ||
module.exports = __toCommonJS(NodeJsEnvironment_exports); | ||
var import_config = require("#config.js"); | ||
var import_general = require("#general"); | ||
@@ -50,2 +51,3 @@ var import_fs = require("fs"); | ||
import_NodeJsActionTracer.NodeJsActionTracer.configure(env); | ||
import_config.config.isInitialized = true; | ||
return env; | ||
@@ -56,8 +58,18 @@ } | ||
vars.addConfigStyle(getDefaults(vars)); | ||
vars.addUnixEnvStyle(process.env); | ||
vars.addArgvStyle(process.argv); | ||
if (import_config.config.loadProcessArgv) { | ||
vars.addUnixEnvStyle(process.env); | ||
} | ||
if (import_config.config.loadProcessEnv) { | ||
vars.addArgvStyle(process.argv); | ||
} | ||
const { configPath, configVars } = loadConfigFile(vars); | ||
vars.addConfigStyle(configVars); | ||
vars.addUnixEnvStyle(process.env); | ||
vars.addArgvStyle(process.argv); | ||
if (import_config.config.loadConfigFile) { | ||
vars.addConfigStyle(configVars); | ||
} | ||
if (import_config.config.loadProcessArgv) { | ||
vars.addUnixEnvStyle(process.env); | ||
} | ||
if (import_config.config.loadProcessEnv) { | ||
vars.addArgvStyle(process.argv); | ||
} | ||
vars.persistConfigValue = async (name, value) => { | ||
@@ -76,2 +88,5 @@ if (value === void 0) { | ||
function configureStorage(env) { | ||
if (!import_config.config.initializeStorage) { | ||
return; | ||
} | ||
const service = env.get(import_general.StorageService); | ||
@@ -106,2 +121,5 @@ env.vars.use(() => { | ||
function getDefaultRoot(envName) { | ||
if (import_config.config.defaultStoragePath !== void 0) { | ||
return import_config.config.defaultStoragePath; | ||
} | ||
let matterDir; | ||
@@ -119,5 +137,5 @@ if (process.platform === "win32") { | ||
function getDefaults(vars) { | ||
const envName = vars.get("environment", "default"); | ||
const envName = vars.get("environment", import_config.config.defaultEnvironmentName); | ||
const rootPath = vars.get("path.root", getDefaultRoot(envName)); | ||
const configPath = (0, import_path.resolve)(rootPath, vars.get("path.config", "config.json")); | ||
const configPath = (0, import_path.resolve)(rootPath, vars.get("path.config", import_config.config.defaultConfigFilePath)); | ||
return { | ||
@@ -130,4 +148,5 @@ environment: envName, | ||
runtime: { | ||
signals: true, | ||
exitcode: true | ||
signals: import_config.config.trapProcessSignals, | ||
exitcode: import_config.config.setProcessExitCodeOnError, | ||
unhandlederrors: import_config.config.trapUnhandledErrors | ||
} | ||
@@ -134,0 +153,0 @@ }; |
@@ -18,4 +18,6 @@ /** | ||
* | ||
* - Via configuration | ||
* - Explicitly (see {@link config}) | ||
* | ||
* - Via configuration (file, command line or system environment variables) | ||
* | ||
* - By modifying {@link Environment.default} | ||
@@ -49,3 +51,3 @@ * | ||
export declare function getDefaults(vars: VariableService): { | ||
environment: "default"; | ||
environment: string; | ||
path: { | ||
@@ -58,4 +60,5 @@ root: string; | ||
exitcode: boolean; | ||
unhandlederrors: boolean; | ||
}; | ||
}; | ||
//# sourceMappingURL=NodeJsEnvironment.d.ts.map |
@@ -6,2 +6,3 @@ /** | ||
*/ | ||
import { config } from "#config.js"; | ||
import { | ||
@@ -32,2 +33,3 @@ Environment, | ||
NodeJsActionTracer.configure(env); | ||
config.isInitialized = true; | ||
return env; | ||
@@ -38,8 +40,18 @@ } | ||
vars.addConfigStyle(getDefaults(vars)); | ||
vars.addUnixEnvStyle(process.env); | ||
vars.addArgvStyle(process.argv); | ||
if (config.loadProcessArgv) { | ||
vars.addUnixEnvStyle(process.env); | ||
} | ||
if (config.loadProcessEnv) { | ||
vars.addArgvStyle(process.argv); | ||
} | ||
const { configPath, configVars } = loadConfigFile(vars); | ||
vars.addConfigStyle(configVars); | ||
vars.addUnixEnvStyle(process.env); | ||
vars.addArgvStyle(process.argv); | ||
if (config.loadConfigFile) { | ||
vars.addConfigStyle(configVars); | ||
} | ||
if (config.loadProcessArgv) { | ||
vars.addUnixEnvStyle(process.env); | ||
} | ||
if (config.loadProcessEnv) { | ||
vars.addArgvStyle(process.argv); | ||
} | ||
vars.persistConfigValue = async (name, value) => { | ||
@@ -58,2 +70,5 @@ if (value === void 0) { | ||
function configureStorage(env) { | ||
if (!config.initializeStorage) { | ||
return; | ||
} | ||
const service = env.get(StorageService); | ||
@@ -88,2 +103,5 @@ env.vars.use(() => { | ||
function getDefaultRoot(envName) { | ||
if (config.defaultStoragePath !== void 0) { | ||
return config.defaultStoragePath; | ||
} | ||
let matterDir; | ||
@@ -101,5 +119,5 @@ if (process.platform === "win32") { | ||
function getDefaults(vars) { | ||
const envName = vars.get("environment", "default"); | ||
const envName = vars.get("environment", config.defaultEnvironmentName); | ||
const rootPath = vars.get("path.root", getDefaultRoot(envName)); | ||
const configPath = resolve(rootPath, vars.get("path.config", "config.json")); | ||
const configPath = resolve(rootPath, vars.get("path.config", config.defaultConfigFilePath)); | ||
return { | ||
@@ -112,4 +130,5 @@ environment: envName, | ||
runtime: { | ||
signals: true, | ||
exitcode: true | ||
signals: config.trapProcessSignals, | ||
exitcode: config.setProcessExitCodeOnError, | ||
unhandlederrors: config.trapUnhandledErrors | ||
} | ||
@@ -116,0 +135,0 @@ }; |
{ | ||
"name": "@matter/nodejs", | ||
"version": "0.11.4", | ||
"version": "0.11.5-alpha.0-20241108-c38ea9922", | ||
"description": "Node.js platform support for matter.js", | ||
@@ -47,14 +47,14 @@ "keywords": [ | ||
"dependencies": { | ||
"@matter/general": "0.11.4", | ||
"@matter/node": "0.11.4", | ||
"@matter/protocol": "0.11.4", | ||
"@matter/types": "0.11.4", | ||
"@matter/general": "0.11.5-alpha.0-20241108-c38ea9922", | ||
"@matter/node": "0.11.5-alpha.0-20241108-c38ea9922", | ||
"@matter/protocol": "0.11.5-alpha.0-20241108-c38ea9922", | ||
"@matter/types": "0.11.5-alpha.0-20241108-c38ea9922", | ||
"node-localstorage": "^3.0.5" | ||
}, | ||
"devDependencies": { | ||
"@matter/model": "0.11.4", | ||
"@matter/protocol": "0.11.4", | ||
"@matter/tools": "0.11.4", | ||
"@matter/testing": "0.11.4", | ||
"@project-chip/matter.js": "0.11.4", | ||
"@matter/model": "0.11.5-alpha.0-20241108-c38ea9922", | ||
"@matter/protocol": "0.11.5-alpha.0-20241108-c38ea9922", | ||
"@matter/tools": "0.11.5-alpha.0-20241108-c38ea9922", | ||
"@matter/testing": "0.11.5-alpha.0-20241108-c38ea9922", | ||
"@project-chip/matter.js": "0.11.5-alpha.0-20241108-c38ea9922", | ||
"@types/bytebuffer": "^5.0.49", | ||
@@ -82,2 +82,12 @@ "@types/node-localstorage": "^1.3.3" | ||
} | ||
}, | ||
"./config": { | ||
"import": { | ||
"types": "./dist/esm/config.d.ts", | ||
"default": "./dist/esm/config.js" | ||
}, | ||
"require": { | ||
"types": "./dist/cjs/config.d.ts", | ||
"default": "./dist/cjs/config.js" | ||
} | ||
} | ||
@@ -84,0 +94,0 @@ }, |
@@ -7,2 +7,3 @@ /** | ||
import { config } from "#config.js"; | ||
import { | ||
@@ -36,4 +37,6 @@ Environment, | ||
* | ||
* - Via configuration | ||
* - Explicitly (see {@link config}) | ||
* | ||
* - Via configuration (file, command line or system environment variables) | ||
* | ||
* - By modifying {@link Environment.default} | ||
@@ -78,2 +81,4 @@ * | ||
config.isInitialized = true; | ||
return env; | ||
@@ -89,12 +94,22 @@ } | ||
// Preload environment and argv so we can use it to find config file | ||
vars.addUnixEnvStyle(process.env); | ||
vars.addArgvStyle(process.argv); | ||
if (config.loadProcessArgv) { | ||
vars.addUnixEnvStyle(process.env); | ||
} | ||
if (config.loadProcessEnv) { | ||
vars.addArgvStyle(process.argv); | ||
} | ||
// Load config files | ||
const { configPath, configVars } = loadConfigFile(vars); | ||
vars.addConfigStyle(configVars); | ||
if (config.loadConfigFile) { | ||
vars.addConfigStyle(configVars); | ||
} | ||
// Reload environment and argv so they override config | ||
vars.addUnixEnvStyle(process.env); | ||
vars.addArgvStyle(process.argv); | ||
if (config.loadProcessArgv) { | ||
vars.addUnixEnvStyle(process.env); | ||
} | ||
if (config.loadProcessEnv) { | ||
vars.addArgvStyle(process.argv); | ||
} | ||
@@ -117,2 +132,6 @@ // Enable persistent configuration values | ||
function configureStorage(env: Environment) { | ||
if (!config.initializeStorage) { | ||
return; | ||
} | ||
const service = env.get(StorageService); | ||
@@ -157,2 +176,5 @@ | ||
function getDefaultRoot(envName: string) { | ||
if (config.defaultStoragePath !== undefined) { | ||
return config.defaultStoragePath; | ||
} | ||
let matterDir; | ||
@@ -173,5 +195,5 @@ if (process.platform === "win32") { | ||
export function getDefaults(vars: VariableService) { | ||
const envName = vars.get("environment", "default"); | ||
const envName = vars.get("environment", config.defaultEnvironmentName); | ||
const rootPath = vars.get("path.root", getDefaultRoot(envName)); | ||
const configPath = resolve(rootPath, vars.get("path.config", "config.json")); | ||
const configPath = resolve(rootPath, vars.get("path.config", config.defaultConfigFilePath)); | ||
@@ -185,6 +207,7 @@ return { | ||
runtime: { | ||
signals: true, | ||
exitcode: true, | ||
signals: config.trapProcessSignals, | ||
exitcode: config.setProcessExitCodeOnError, | ||
unhandlederrors: config.trapUnhandledErrors, | ||
}, | ||
}; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
294035
213
5598
+ Added@matter/general@0.11.5-alpha.0-20241108-c38ea9922(transitive)
+ Added@matter/model@0.11.5-alpha.0-20241108-c38ea9922(transitive)
+ Added@matter/node@0.11.5-alpha.0-20241108-c38ea9922(transitive)
+ Added@matter/protocol@0.11.5-alpha.0-20241108-c38ea9922(transitive)
+ Added@matter/types@0.11.5-alpha.0-20241108-c38ea9922(transitive)
- Removed@matter/general@0.11.4(transitive)
- Removed@matter/model@0.11.4(transitive)
- Removed@matter/node@0.11.4(transitive)
- Removed@matter/protocol@0.11.4(transitive)
- Removed@matter/types@0.11.4(transitive)