iobroker.javascript 9.3.0 → 10.0.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.
- package/README.md +8 -9
- package/admin/assets/AiChatPanel-p0KAg6Cs.js +237 -0
- package/admin/assets/AiDatapointProvider-DzFpUKkT.js +2 -0
- package/admin/assets/AiDiffView-BPTLnNx1.js +1 -0
- package/admin/assets/AiInlineProvider-CaHd2G2Q.js +5 -0
- package/admin/assets/AiScriptAnalyzer--BHML2rN.js +9 -0
- package/admin/assets/BlocklyEditor-CAjVMhYT.js +81 -0
- package/admin/assets/ContextWrapper-BVc8wTK_.css +1 -0
- package/admin/assets/ContextWrapper-D9CrnNKs.js +127 -0
- package/admin/assets/Debugger-SjROokFI.js +15 -0
- package/admin/assets/Error-DDfrxAt2.js +1 -0
- package/admin/assets/Import-DpTg1Jow.js +1 -0
- package/admin/assets/RulesEditor-BSRFWpEm.css +1 -0
- package/admin/assets/RulesEditor-D0hgrcBc.js +1 -0
- package/admin/assets/ScriptEditor-BGIuoNei.js +2 -0
- package/admin/assets/ScriptEditorVanillaMonaco-DyMQtoTQ.js +3 -0
- package/admin/assets/_virtual_mf-localSharedImportMap___mfe_internal__iobroker_javascript__mf_owner__1-DWJotR1B.js +1 -0
- package/admin/assets/_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-CxICLr5Z.js +1243 -0
- package/admin/assets/_virtual_mf___mfe_internal__iobroker_javascript__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-BBAXJaqI.js +9 -0
- package/admin/assets/aiCodeLensProvider-hyAmut0e.js +4 -0
- package/admin/assets/aiPromptBuilder-Bs27qOHT.js +7 -0
- package/admin/assets/applyCodeEdit-D3nb7erO.js +1 -0
- package/admin/assets/blocklyDarkTheme-DEiAX5DT.js +1 -0
- package/admin/assets/cronHoverProvider-pKJkSevo.js +2 -0
- package/admin/assets/dist-uw5orDgd.js +4 -0
- package/admin/assets/{docs-compact-CKNGiYh2.js → docs-compact-D7rpMc7r.js} +2 -2
- package/admin/assets/hostInit-BFg5u9hY.js +1 -0
- package/admin/assets/index-B1gICjdq.js +192 -0
- package/admin/assets/index-BHhhebRG.css +1 -0
- package/admin/assets/inlineChatWidget-ZaisTOLh.js +2 -0
- package/admin/assets/inlineDiffController-hTwHHqcc.js +16 -0
- package/admin/assets/mf-entry-bootstrap-0-d6052b31.js +36 -0
- package/admin/assets/mjs-DWqivHEk.js +90 -0
- package/admin/assets/rolldown-runtime-C0FnF6B9.js +1 -0
- package/admin/assets/stateHoverProvider-C7DawIs-.js +9 -0
- package/admin/assets/virtualExposes-Ed0lGq7k.js +1 -0
- package/admin/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__iobroker_javascript__remoteEntry_js-BYs71IQF.js +1 -0
- package/admin/assets/virtual_mf-exposes___mfe_internal__iobroker_javascript__remoteEntry_js-DnnXQRkG.js +1 -0
- package/admin/assets/vite-preload-helper-B7qeedMF.js +1 -0
- package/admin/custom/assets/Components-BrDyDHXh.js +1 -0
- package/admin/custom/assets/Components-DftM8alF.css +1 -0
- package/admin/custom/assets/_virtual_mf-localSharedImportMap___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1-CyYJM2-v.js +1 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_emotion_mf_1_react__loadShare__.js-BdzCssLn.js +1 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_emotion_mf_1_styled__loadShare__.js-CGb5Cofy.js +1 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_gui_mf_2_components__loadShare__.js-BVCIAgbo.js +1243 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.js-BkB0anQX.js +1494 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare__leaflet__loadShare__.js-h-rCw3iz.js +1 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-BotqDuw-.js +9 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__prebuild__date_mf_2_fns__prebuild__-Cb5TR7FB.js +1 -0
- package/admin/custom/assets/_virtual_mf___mfe_internal__ConfigCustomJavascriptSet__mf_owner__1__prebuild__leaflet__prebuild__-DARUoA03.js +1 -0
- package/admin/custom/assets/hostInit-DJx2uXXy.js +1 -0
- package/admin/custom/assets/index-uEKAoVT7.js +1 -0
- package/admin/custom/assets/lib-Yj8cfN0A.js +3 -0
- package/admin/custom/assets/mf-entry-bootstrap-0-77793feb.js +36 -0
- package/admin/custom/assets/rolldown-runtime-BcKkbAw3.js +1 -0
- package/admin/custom/assets/setYear-DJ9FbdkO.js +1 -0
- package/admin/custom/assets/virtualExposes-CxDjLoYu.js +1 -0
- package/admin/custom/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-BU-ugy_7.js +1 -0
- package/admin/custom/assets/virtual_mf-exposes-ssr___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-BEfZbrf7.js +2 -0
- package/admin/custom/assets/virtual_mf-exposes___mfe_internal__ConfigCustomJavascriptSet__customComponents_js-CTeZ0Jpm.js +2 -0
- package/admin/custom/assets/vite-preload-helper-B7qeedMF.js +1 -0
- package/admin/custom/customComponents.js +1 -1
- package/admin/jsonConfig.json +1 -1
- package/admin/mf-manifest.json +1 -1
- package/admin/mf-stats.json +1 -0
- package/admin/remoteEntry.js +1 -1
- package/admin/tab.html +12 -17
- package/build/lib/debugger.js +1 -1
- package/build/lib/debugger.js.map +1 -1
- package/build/lib/eventObj.js.map +1 -1
- package/build/lib/inspect.js.map +1 -1
- package/build/lib/javascript.d.ts +18 -19
- package/build/lib/nodeModulesManagement.js +3 -1
- package/build/lib/nodeModulesManagement.js.map +1 -1
- package/build/lib/protectFs.js.map +1 -1
- package/build/lib/sandbox.js +104 -43
- package/build/lib/sandbox.js.map +1 -1
- package/build/lib/scheduler.js.map +1 -1
- package/build/lib/tools.js +1 -1
- package/build/lib/tools.js.map +1 -1
- package/build/lib/typescriptSettings.js +16 -10
- package/build/lib/typescriptSettings.js.map +1 -1
- package/build/lib/typescriptTools.js +2 -2
- package/build/lib/typescriptTools.js.map +1 -1
- package/build/main.js +41 -29
- package/build/main.js.map +1 -1
- package/build/src/lib/aiProviderResolver.js +107 -0
- package/build/src/lib/aiProviderResolver.js.map +1 -0
- package/build/src/lib/anthropicAdapter.js +175 -0
- package/build/src/lib/anthropicAdapter.js.map +1 -0
- package/build/src/lib/consts.js +346 -0
- package/build/src/lib/consts.js.map +1 -0
- package/build/src/lib/convert.js +121 -0
- package/build/src/lib/convert.js.map +1 -0
- package/build/src/lib/crypto.js +32 -0
- package/build/src/lib/crypto.js.map +1 -0
- package/build/src/lib/debug.js +163 -0
- package/build/src/lib/debug.js.map +1 -0
- package/build/src/lib/debugger.js +1135 -0
- package/build/src/lib/debugger.js.map +1 -0
- package/build/src/lib/eventObj.js +194 -0
- package/build/src/lib/eventObj.js.map +1 -0
- package/build/src/lib/inspect.js +728 -0
- package/build/src/lib/inspect.js.map +1 -0
- package/build/src/lib/mirror.js +634 -0
- package/build/src/lib/mirror.js.map +1 -0
- package/build/src/lib/nodeModulesManagement.js +26 -0
- package/build/src/lib/nodeModulesManagement.js.map +1 -0
- package/build/src/lib/patternCompareFunctions.js +293 -0
- package/build/src/lib/patternCompareFunctions.js.map +1 -0
- package/build/src/lib/protectFs.js +554 -0
- package/build/src/lib/protectFs.js.map +1 -0
- package/build/src/lib/sandbox.js +4897 -0
- package/build/src/lib/sandbox.js.map +1 -0
- package/build/src/lib/scheduler.js +555 -0
- package/build/src/lib/scheduler.js.map +1 -0
- package/build/src/lib/tools.js +188 -0
- package/build/src/lib/tools.js.map +1 -0
- package/build/src/lib/typescriptSettings.js +39 -0
- package/build/src/lib/typescriptSettings.js.map +1 -0
- package/build/src/lib/typescriptTools.js +435 -0
- package/build/src/lib/typescriptTools.js.map +1 -0
- package/build/src/lib/utils.js +66 -0
- package/build/src/lib/utils.js.map +1 -0
- package/build/src/lib/words.js +76 -0
- package/build/src/lib/words.js.map +1 -0
- package/build/src/main.js +3414 -0
- package/build/src/main.js.map +1 -0
- package/build/types.d.ts +6 -14
- package/io-package.json +28 -28
- package/package.json +16 -17
- package/admin/assets/AiChatPanel-BvND3KNP.js +0 -317
- package/admin/assets/AiDatapointProvider-B0i3I5Fm.js +0 -2
- package/admin/assets/AiDiffView-RPozjjHf.js +0 -1
- package/admin/assets/AiInlineProvider-DkgjVSFQ.js +0 -7
- package/admin/assets/Save-CkuNSiWL.js +0 -1
- package/admin/assets/ScriptEditor-1BwI9a_X.js +0 -2
- package/admin/assets/ScriptEditorVanillaMonaco-BPK75VNu.js +0 -3
- package/admin/assets/applyCodeEdit-BdRnbz2g.js +0 -1
- package/admin/assets/createSvgIcon-DYs_tNrE.js +0 -8
- package/admin/assets/cronHoverProvider-Bg0Vz-1E.js +0 -2
- package/admin/assets/hostInit-LzITLWDa.js +0 -1
- package/admin/assets/index-45IwpC7_.js +0 -1
- package/admin/assets/index-BCK6q-N6.css +0 -1
- package/admin/assets/index-BTsjunTt.css +0 -1
- package/admin/assets/index-Be9Zg6aF.js +0 -990
- package/admin/assets/index-BkyLyaYT.js +0 -8
- package/admin/assets/index-CVZSzCXy.js +0 -1
- package/admin/assets/index-CxRhXAwi.js +0 -1267
- package/admin/assets/index-DUMiVB6k.js +0 -16
- package/admin/assets/index-Dsh1HfIY.js +0 -1
- package/admin/assets/index-dN73sbyQ.js +0 -193
- package/admin/assets/index-fS-54-pB.js +0 -1
- package/admin/assets/index-wHNMOf-c.js +0 -5
- package/admin/assets/inheritsLoose-CIXm_zPk.js +0 -29
- package/admin/assets/inlineChatWidget-Cu6rb4Ar.js +0 -2
- package/admin/assets/inlineDiffController-DBLpPOe2.js +0 -16
- package/admin/assets/iobroker_javascript__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__.mjs-DkBjPSMw.js +0 -1
- package/admin/assets/iobroker_javascript__loadShare___mf_0_mui_mf_1_material__loadShare__.mjs-CV1_X-Lf.js +0 -1
- package/admin/assets/iobroker_javascript__loadShare__prop_mf_2_types__loadShare__.mjs-BCtSFofY.js +0 -1
- package/admin/assets/iobroker_javascript__loadShare__react__loadShare__.mjs-CTZOFJS2.js +0 -1
- package/admin/assets/iobroker_javascript__loadShare__react__loadShare__.mjs_commonjs-proxy-CE9lvhW8.js +0 -1
- package/admin/assets/iobroker_javascript__loadShare__react_mf_2_dom__loadShare__.mjs-DeVAS-oa.js +0 -1
- package/admin/assets/iobroker_javascript__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-RQRRZMX5.js +0 -1
- package/admin/assets/localSharedImportMap-Cs4ibnCv.js +0 -1
- package/admin/assets/preload-helper-BDBacUwf.js +0 -1
- package/admin/assets/stateHoverProvider-dvzAyUDH.js +0 -9
- package/admin/assets/useTheme-DuTJsNQ-.js +0 -1
- package/admin/assets/virtualExposes-BPsCufin.js +0 -1
- package/admin/assets/virtual_mf-REMOTE_ENTRY_ID_iobroker_javascript__remoteEntry_js-Dus28I2g.js +0 -8
- package/admin/custom/assets/Components-BOms95_F.css +0 -1
- package/admin/custom/assets/Components-CGiJE5Zh.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_emotion_mf_1_react__loadShare__.mjs-sg07E3QA.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_emotion_mf_1_styled__loadShare__.mjs-CwjI4A-J.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__.mjs-B7D2xOvV.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__.mjs-ClsgYnEX.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__.mjs-B551AMx-.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_material__loadShare__.mjs-KsT5vKjV.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_x_mf_2_date_mf_2_pickers__loadShare__.mjs-DgHZUNxn.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__leaflet__loadShare__.mjs-BYONkEgA.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__react__loadShare__.mjs-BW9Qbxx5.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__react__loadShare__.mjs_commonjs-proxy-2W2BYT2K.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__react_mf_2_dom__loadShare__.mjs-CL--xmjC.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-D8zcZsJo.js +0 -1
- package/admin/custom/assets/DefaultPropsProvider-CfKHPa-G.js +0 -1
- package/admin/custom/assets/TextField-CxPfV5Sr.js +0 -139
- package/admin/custom/assets/ThemeProvider-DSTCckLJ.js +0 -29
- package/admin/custom/assets/blue-CagzI6CQ.js +0 -1
- package/admin/custom/assets/createSvgIcon-b2B2NI3g.js +0 -1
- package/admin/custom/assets/createTheme-MsdB8zt7.js +0 -8
- package/admin/custom/assets/defaultTheme-CmVP-QNF.js +0 -1
- package/admin/custom/assets/emotion-cache.browser.esm-BgJfNZJN.js +0 -1
- package/admin/custom/assets/emotion-react.browser.esm-chZAeh_-.js +0 -1
- package/admin/custom/assets/emotion-serialize.esm-BUa21YfQ.js +0 -1
- package/admin/custom/assets/emotion-styled.browser.esm-Yi13plpH.js +0 -1
- package/admin/custom/assets/emotion-use-insertion-effect-with-fallbacks.browser.esm-CEPeBbh9.js +0 -1
- package/admin/custom/assets/extends-CF3RwP-h.js +0 -1
- package/admin/custom/assets/hostInit-iUL-wyj1.js +0 -1
- package/admin/custom/assets/index-17vbGv00.js +0 -1
- package/admin/custom/assets/index-B5DqCD_a.js +0 -1
- package/admin/custom/assets/index-BVOepGI5.js +0 -1
- package/admin/custom/assets/index-Bvwv5H7k.js +0 -1
- package/admin/custom/assets/index-C8_qJ4Y6.js +0 -1523
- package/admin/custom/assets/index-CzRngQHl.js +0 -31
- package/admin/custom/assets/index-DLNtxshy.js +0 -1
- package/admin/custom/assets/index-DSGXVHGh.js +0 -964
- package/admin/custom/assets/index-DV76KW3-.js +0 -7
- package/admin/custom/assets/index-D_5kZmfw.js +0 -1
- package/admin/custom/assets/index-DlQbqHom.js +0 -8
- package/admin/custom/assets/index-DpJ18x6R.js +0 -1
- package/admin/custom/assets/index-FTmk0JJx.js +0 -55
- package/admin/custom/assets/isSameWeek-DDsSIa_t.js +0 -1
- package/admin/custom/assets/jsx-runtime-BplTyRFk.js +0 -1
- package/admin/custom/assets/leaflet-src-B472P7Y1.js +0 -1
- package/admin/custom/assets/localSharedImportMap-C-8wOKN2.js +0 -1
- package/admin/custom/assets/preload-helper-BDBacUwf.js +0 -1
- package/admin/custom/assets/useTheme-BV4xOYIL.js +0 -1
- package/admin/custom/assets/useTheme-ldICnlmf.js +0 -1
- package/admin/custom/assets/virtualExposes-D402kVGY.js +0 -2
- package/admin/custom/assets/virtual_mf-REMOTE_ENTRY_ID_ConfigCustomJavascriptSet__customComponents_js-CO2hfDx_.js +0 -8
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const nodeFS = __importStar(require("node:fs"));
|
|
37
|
+
const node_path_1 = require("node:path");
|
|
38
|
+
class ProtectFs {
|
|
39
|
+
log;
|
|
40
|
+
ioBrokerDataDir;
|
|
41
|
+
promises;
|
|
42
|
+
constants;
|
|
43
|
+
static log = null;
|
|
44
|
+
static staticIoBrokerDataDir = '';
|
|
45
|
+
constructor(log, ioBrokerDataDir) {
|
|
46
|
+
this.ioBrokerDataDir = ioBrokerDataDir;
|
|
47
|
+
ProtectFs.staticIoBrokerDataDir = ioBrokerDataDir;
|
|
48
|
+
this.log = log || {
|
|
49
|
+
silly: (message) => console.log(message),
|
|
50
|
+
debug: (message) => console.debug(message),
|
|
51
|
+
info: (message) => console.info(message),
|
|
52
|
+
warn: (message) => console.warn(message),
|
|
53
|
+
error: (message) => console.error(message),
|
|
54
|
+
level: 'info',
|
|
55
|
+
};
|
|
56
|
+
ProtectFs.log = this.log;
|
|
57
|
+
this.promises = {
|
|
58
|
+
access: async (path, mode) => {
|
|
59
|
+
ProtectFs.checkProtected(path, true);
|
|
60
|
+
return nodeFS.promises.access(path, mode);
|
|
61
|
+
},
|
|
62
|
+
cp: async (source, destination, opts) => {
|
|
63
|
+
ProtectFs.checkProtected(source, false);
|
|
64
|
+
ProtectFs.checkProtected(destination, false);
|
|
65
|
+
return nodeFS.promises.cp(source, destination, opts);
|
|
66
|
+
},
|
|
67
|
+
readFile: async (path, options) => {
|
|
68
|
+
ProtectFs.checkProtected(path, true);
|
|
69
|
+
return nodeFS.promises.readFile(path, options); // async function readFile(path, options) {
|
|
70
|
+
},
|
|
71
|
+
readlink: async (path, options) => {
|
|
72
|
+
ProtectFs.checkProtected(path, true);
|
|
73
|
+
return nodeFS.promises.readlink(path, options); // async function readlink(path, options) {
|
|
74
|
+
},
|
|
75
|
+
symlink: async (target, path, type) => {
|
|
76
|
+
ProtectFs.checkProtected(target, true);
|
|
77
|
+
ProtectFs.checkProtected(path, false);
|
|
78
|
+
return nodeFS.promises.symlink(target, path, type); // async function symlink(target, path, type_) {
|
|
79
|
+
},
|
|
80
|
+
writeFile: async (file, data, options) => {
|
|
81
|
+
ProtectFs.checkProtected(file, true);
|
|
82
|
+
return nodeFS.promises.writeFile.call(this, file, data, options); // async function writeFile(path, data, options) {
|
|
83
|
+
},
|
|
84
|
+
unlink: async (path) => {
|
|
85
|
+
ProtectFs.checkProtected(path, false);
|
|
86
|
+
return nodeFS.promises.unlink.call(this, path); // async function unlink(path) {
|
|
87
|
+
},
|
|
88
|
+
appendFile: async (path, data, options) => {
|
|
89
|
+
ProtectFs.checkProtected(path, false);
|
|
90
|
+
return nodeFS.promises.appendFile.call(this, path, data, options); // async function appendFile(path, data, options) {
|
|
91
|
+
},
|
|
92
|
+
chmod: async (path, mode) => {
|
|
93
|
+
ProtectFs.checkProtected(path, false);
|
|
94
|
+
return nodeFS.promises.chmod.call(this, path, mode); // async function chmod(path, mode) {
|
|
95
|
+
},
|
|
96
|
+
copyFile: async (src, dest, mode) => {
|
|
97
|
+
ProtectFs.checkProtected(src, false);
|
|
98
|
+
ProtectFs.checkProtected(dest, false);
|
|
99
|
+
return nodeFS.promises.copyFile.call(this, src, dest, mode); // async function copyFile(src, dest, mode) {
|
|
100
|
+
},
|
|
101
|
+
rename: async (oldPath, newPath) => {
|
|
102
|
+
ProtectFs.checkProtected(oldPath, false);
|
|
103
|
+
ProtectFs.checkProtected(newPath, false);
|
|
104
|
+
return nodeFS.promises.rename.call(this, oldPath, newPath); // async function rename(oldPath, newPath) {
|
|
105
|
+
},
|
|
106
|
+
open: async (path, flags, mode) => {
|
|
107
|
+
ProtectFs.checkProtected(path, true);
|
|
108
|
+
return nodeFS.promises.open.call(this, path, flags, mode); // async function open(path, flags, mode) {
|
|
109
|
+
},
|
|
110
|
+
truncate: async (path, len) => {
|
|
111
|
+
ProtectFs.checkProtected(path, false);
|
|
112
|
+
return nodeFS.promises.truncate.call(this, path, len); // async function truncate(path, len = 0) {
|
|
113
|
+
},
|
|
114
|
+
stat: async (path, opts) => {
|
|
115
|
+
ProtectFs.checkProtected(path, true);
|
|
116
|
+
const result = await nodeFS.promises.stat.call(this, path, opts); // async function stat(path, options = { bigint: false }) {
|
|
117
|
+
return result;
|
|
118
|
+
},
|
|
119
|
+
utimes: async (path, atime, mtime) => {
|
|
120
|
+
ProtectFs.checkProtected(path, false);
|
|
121
|
+
return nodeFS.promises.utimes.call(this, path, atime, mtime); // async function utimes(path, atime, mtime) {
|
|
122
|
+
},
|
|
123
|
+
readdir: async (path, options) => {
|
|
124
|
+
ProtectFs.checkProtected(path, true);
|
|
125
|
+
// @ts-expect-error fix later
|
|
126
|
+
return nodeFS.promises.readdir.call(this, path, options || { encoding: null, withFileTypes: true }); // async function readdir(path, options) {
|
|
127
|
+
},
|
|
128
|
+
lchmod: async (path, mode) => {
|
|
129
|
+
ProtectFs.checkProtected(path, false);
|
|
130
|
+
return nodeFS.promises.lchmod.call(this, path, mode); // async function lchmod(path, mode) {
|
|
131
|
+
},
|
|
132
|
+
lchown: async (path, uid, gid) => {
|
|
133
|
+
ProtectFs.checkProtected(path, false);
|
|
134
|
+
return nodeFS.promises.lchown.call(this, path, uid, gid); // async function lchown(path, uid, gid) {
|
|
135
|
+
},
|
|
136
|
+
link: async (existingPath, newPath) => {
|
|
137
|
+
ProtectFs.checkProtected(existingPath, false);
|
|
138
|
+
ProtectFs.checkProtected(newPath, false);
|
|
139
|
+
return nodeFS.promises.link.call(this, existingPath, newPath); // async function link(existingPath, newPath) {
|
|
140
|
+
},
|
|
141
|
+
lstat: async (path, opts) => {
|
|
142
|
+
ProtectFs.checkProtected(path, true);
|
|
143
|
+
const res = await nodeFS.promises.lstat.call(this, path, opts); // async function lstat(path, options = { bigint: false }) {
|
|
144
|
+
return res;
|
|
145
|
+
},
|
|
146
|
+
lutimes: async (path, atime, mtime) => {
|
|
147
|
+
ProtectFs.checkProtected(path, false);
|
|
148
|
+
return nodeFS.promises.lutimes.call(this, path, atime, mtime); // async function lutimes(path, atime, mtime) {
|
|
149
|
+
},
|
|
150
|
+
mkdir: async (path, options) => {
|
|
151
|
+
ProtectFs.checkProtected(path, false);
|
|
152
|
+
return nodeFS.promises.mkdir.call(this, path, options); // async function mkdir(path, options) {
|
|
153
|
+
},
|
|
154
|
+
mkdtemp: async (prefix, options) => {
|
|
155
|
+
ProtectFs.checkProtected(prefix, false);
|
|
156
|
+
const tmp = await nodeFS.promises.mkdtemp.call(this, prefix, options); // async function mkdtemp(prefix, options) {
|
|
157
|
+
return tmp.toString();
|
|
158
|
+
},
|
|
159
|
+
rm: async (path, options) => {
|
|
160
|
+
ProtectFs.checkProtected(path, false);
|
|
161
|
+
return nodeFS.promises.rm.call(this, path, options); // async function rm(path, options) {
|
|
162
|
+
},
|
|
163
|
+
rmdir: async (path) => {
|
|
164
|
+
ProtectFs.checkProtected(path, false);
|
|
165
|
+
return nodeFS.promises.rmdir.call(this, path); // async function rmdir(path, options) {
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
// Add missing constants
|
|
169
|
+
this.constants = nodeFS.constants;
|
|
170
|
+
// Add missing functions
|
|
171
|
+
for (const m in nodeFS) {
|
|
172
|
+
if (typeof nodeFS[m] === 'function' &&
|
|
173
|
+
Object.hasOwn(nodeFS, m) &&
|
|
174
|
+
!Object.hasOwn(Object.getPrototypeOf(this), 'appendFile')) {
|
|
175
|
+
// console.debug(`Missing function in ProtectFS: ${m} - adding from node:fs`);
|
|
176
|
+
// @ts-expect-error Elsewise we must implement EVERY function in fs
|
|
177
|
+
this[m] = nodeFS[m];
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
for (const m in nodeFS.promises) {
|
|
181
|
+
if (typeof nodeFS.promises[m] === 'function' &&
|
|
182
|
+
Object.hasOwn(nodeFS.promises, m) &&
|
|
183
|
+
!Object.hasOwn(this.promises, m)) {
|
|
184
|
+
// console.debug(`Missing function in ProtectFS: ${m} - adding from node:fs/promises`);
|
|
185
|
+
// @ts-expect-error Elsewise we must implement EVERY function in fs
|
|
186
|
+
this.promises[m] = nodeFS.promises[m];
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
static checkProtected(file, readOnly) {
|
|
191
|
+
if (file.fd) {
|
|
192
|
+
// FileHandle objects bypass path checks — they were already validated at open() time.
|
|
193
|
+
// This is safe because the sandbox only exposes the wrapped fs where open() is protected.
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
let filePath;
|
|
197
|
+
try {
|
|
198
|
+
// Use resolve() instead of normalize() to get an absolute path and eliminate .. traversals.
|
|
199
|
+
// Then try realpath to resolve symlinks — fall back to resolved path if file doesn't exist yet.
|
|
200
|
+
const resolved = (0, node_path_1.resolve)(file.toString());
|
|
201
|
+
try {
|
|
202
|
+
filePath = nodeFS.realpathSync(resolved);
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
filePath = resolved;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
catch {
|
|
209
|
+
filePath = (0, node_path_1.normalize)(file.toString());
|
|
210
|
+
}
|
|
211
|
+
if (filePath.endsWith(`-data${node_path_1.sep}objects.json`) || filePath.endsWith(`-data${node_path_1.sep}objects.jsonl`)) {
|
|
212
|
+
ProtectFs.log?.error(`May not access ${file.toString()}`);
|
|
213
|
+
throw new Error('Permission denied');
|
|
214
|
+
}
|
|
215
|
+
if (!readOnly && filePath.startsWith((0, node_path_1.join)(ProtectFs.staticIoBrokerDataDir, 'files'))) {
|
|
216
|
+
ProtectFs.log?.error(`May not write ${file.toString()} - use writeFile instead`);
|
|
217
|
+
throw new Error('Permission denied');
|
|
218
|
+
}
|
|
219
|
+
if (!readOnly && filePath.startsWith(`file://${(0, node_path_1.join)(ProtectFs.staticIoBrokerDataDir, 'files')}`)) {
|
|
220
|
+
ProtectFs.log?.error(`May not write ${file.toString()} - use writeFile instead`);
|
|
221
|
+
throw new Error('Permission denied');
|
|
222
|
+
}
|
|
223
|
+
// Disallow writing into node_modules directories (see #2127)
|
|
224
|
+
if (!readOnly && `${node_path_1.sep}${filePath}${node_path_1.sep}`.includes(`${node_path_1.sep}node_modules${node_path_1.sep}`)) {
|
|
225
|
+
ProtectFs.log?.error(`May not write into node_modules: ${file.toString()}`);
|
|
226
|
+
throw new Error('Permission denied. Writing into node_modules is not allowed');
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
access(path, mode, callback) {
|
|
230
|
+
ProtectFs.checkProtected(path, true);
|
|
231
|
+
if (typeof callback === 'function') {
|
|
232
|
+
return nodeFS.access(path, mode, callback);
|
|
233
|
+
}
|
|
234
|
+
return nodeFS.access(path, mode);
|
|
235
|
+
}
|
|
236
|
+
accessSync(path, mode) {
|
|
237
|
+
ProtectFs.checkProtected(path, true);
|
|
238
|
+
return nodeFS.accessSync(path, mode);
|
|
239
|
+
}
|
|
240
|
+
cp(source, destination, opts, callback) {
|
|
241
|
+
ProtectFs.checkProtected(source, false);
|
|
242
|
+
ProtectFs.checkProtected(destination, false);
|
|
243
|
+
if (callback) {
|
|
244
|
+
return nodeFS.cp(source, destination, opts, callback);
|
|
245
|
+
}
|
|
246
|
+
if (typeof opts === 'function') {
|
|
247
|
+
return nodeFS.cp(source, destination, opts);
|
|
248
|
+
}
|
|
249
|
+
return nodeFS.cp(source, destination, opts);
|
|
250
|
+
}
|
|
251
|
+
cpSync(source, destination, opts) {
|
|
252
|
+
ProtectFs.checkProtected(source, false);
|
|
253
|
+
ProtectFs.checkProtected(destination, false);
|
|
254
|
+
return nodeFS.cpSync.call(this, source, destination, opts);
|
|
255
|
+
}
|
|
256
|
+
readFile(path, options, callback) {
|
|
257
|
+
if (typeof path !== 'number') {
|
|
258
|
+
ProtectFs.checkProtected(path, true);
|
|
259
|
+
}
|
|
260
|
+
if (typeof callback === 'function') {
|
|
261
|
+
return nodeFS.readFile.call(this, path, options,
|
|
262
|
+
// @ts-expect-error readFile can accept 3 arguments too
|
|
263
|
+
callback);
|
|
264
|
+
}
|
|
265
|
+
return nodeFS.readFile.call(this, path, options);
|
|
266
|
+
}
|
|
267
|
+
readFileSync(path, options) {
|
|
268
|
+
if (typeof path !== 'number') {
|
|
269
|
+
ProtectFs.checkProtected(path, true);
|
|
270
|
+
}
|
|
271
|
+
return nodeFS.readFileSync.call(this, path, options);
|
|
272
|
+
}
|
|
273
|
+
readlink(path, options, callback) {
|
|
274
|
+
ProtectFs.checkProtected(path, true);
|
|
275
|
+
if (typeof callback === 'function') {
|
|
276
|
+
// @ts-expect-error should work
|
|
277
|
+
return nodeFS.readlink.call(this, path, options, callback); //
|
|
278
|
+
}
|
|
279
|
+
return nodeFS.readlink.call(this, path, options);
|
|
280
|
+
}
|
|
281
|
+
readlinkSync(path, options) {
|
|
282
|
+
ProtectFs.checkProtected(path, true);
|
|
283
|
+
return nodeFS.readlinkSync.call(this, path, options);
|
|
284
|
+
}
|
|
285
|
+
symlink(target, path, type, callback) {
|
|
286
|
+
ProtectFs.checkProtected(target, true);
|
|
287
|
+
ProtectFs.checkProtected(path, false);
|
|
288
|
+
if (typeof callback === 'function') {
|
|
289
|
+
// @ts-expect-error should work
|
|
290
|
+
return nodeFS.symlink.call(this, target, path, type, callback);
|
|
291
|
+
}
|
|
292
|
+
return nodeFS.symlink.call(this, target, path, type);
|
|
293
|
+
}
|
|
294
|
+
symlinkSync(target, path, type) {
|
|
295
|
+
ProtectFs.checkProtected(target, true);
|
|
296
|
+
ProtectFs.checkProtected(path, false);
|
|
297
|
+
return nodeFS.symlinkSync.call(this, target, path, type);
|
|
298
|
+
}
|
|
299
|
+
writeFile(file, data, options, callback) {
|
|
300
|
+
if (typeof file !== 'number') {
|
|
301
|
+
ProtectFs.checkProtected(file, false);
|
|
302
|
+
}
|
|
303
|
+
if (typeof callback === 'function') {
|
|
304
|
+
// @ts-expect-error should work
|
|
305
|
+
return nodeFS.writeFile.call(this, file, data, options, callback);
|
|
306
|
+
}
|
|
307
|
+
return nodeFS.writeFile.call(this, file, data, options);
|
|
308
|
+
}
|
|
309
|
+
writeFileSync(file, data, options) {
|
|
310
|
+
if (typeof file !== 'number') {
|
|
311
|
+
ProtectFs.checkProtected(file, false);
|
|
312
|
+
}
|
|
313
|
+
return nodeFS.writeFileSync.call(this, file, data, options);
|
|
314
|
+
}
|
|
315
|
+
unlink(path, callback) {
|
|
316
|
+
ProtectFs.checkProtected(path, false);
|
|
317
|
+
return nodeFS.unlink.call(this, path, callback || ((_err) => { }));
|
|
318
|
+
}
|
|
319
|
+
unlinkSync(path) {
|
|
320
|
+
ProtectFs.checkProtected(path, false);
|
|
321
|
+
return nodeFS.unlinkSync.call(this, path);
|
|
322
|
+
}
|
|
323
|
+
appendFile(file, data, options, callback) {
|
|
324
|
+
if (typeof file !== 'number') {
|
|
325
|
+
ProtectFs.checkProtected(file, false);
|
|
326
|
+
}
|
|
327
|
+
if (typeof callback === 'function') {
|
|
328
|
+
// @ts-expect-error should work
|
|
329
|
+
return nodeFS.appendFile.call(this, file, data, options, callback);
|
|
330
|
+
}
|
|
331
|
+
return nodeFS.appendFile.call(this, file, data, options);
|
|
332
|
+
}
|
|
333
|
+
appendFileSync(file, data, options) {
|
|
334
|
+
if (typeof file !== 'number') {
|
|
335
|
+
ProtectFs.checkProtected(file, false);
|
|
336
|
+
}
|
|
337
|
+
return nodeFS.appendFileSync.call(this, file, data, options);
|
|
338
|
+
}
|
|
339
|
+
chmod(path, mode, callback) {
|
|
340
|
+
ProtectFs.checkProtected(path, false);
|
|
341
|
+
return nodeFS.chmod.call(this, path, mode, callback || ((_err) => { }));
|
|
342
|
+
}
|
|
343
|
+
chmodSync(path, mode) {
|
|
344
|
+
ProtectFs.checkProtected(path, false);
|
|
345
|
+
return nodeFS.chmodSync.call(this, path, mode);
|
|
346
|
+
}
|
|
347
|
+
chown(path, uid, gid, callback) {
|
|
348
|
+
ProtectFs.checkProtected(path, false);
|
|
349
|
+
return nodeFS.chown.call(this, path, uid, gid, callback || ((_err) => { }));
|
|
350
|
+
}
|
|
351
|
+
chownSync(path, uid, gid) {
|
|
352
|
+
ProtectFs.checkProtected(path, false);
|
|
353
|
+
return nodeFS.chownSync.call(this, path, uid, gid);
|
|
354
|
+
}
|
|
355
|
+
copyFile(src, dest, mode, callback) {
|
|
356
|
+
ProtectFs.checkProtected(src, true);
|
|
357
|
+
ProtectFs.checkProtected(dest, false);
|
|
358
|
+
// @ts-expect-error should work
|
|
359
|
+
return nodeFS.copyFile.call(this, src, dest, mode, callback);
|
|
360
|
+
}
|
|
361
|
+
copyFileSync(src, dest, mode) {
|
|
362
|
+
ProtectFs.checkProtected(src, true);
|
|
363
|
+
ProtectFs.checkProtected(dest, false);
|
|
364
|
+
return nodeFS.copyFileSync.call(this, src, dest, mode);
|
|
365
|
+
}
|
|
366
|
+
rename(oldPath, newPath, callback) {
|
|
367
|
+
ProtectFs.checkProtected(oldPath, false);
|
|
368
|
+
ProtectFs.checkProtected(newPath, false);
|
|
369
|
+
return nodeFS.rename.call(this, oldPath, newPath, callback || ((_err) => { }));
|
|
370
|
+
}
|
|
371
|
+
renameSync(oldPath, newPath) {
|
|
372
|
+
ProtectFs.checkProtected(oldPath, false);
|
|
373
|
+
ProtectFs.checkProtected(newPath, false);
|
|
374
|
+
return nodeFS.renameSync.call(this, oldPath, newPath);
|
|
375
|
+
}
|
|
376
|
+
open(path, callback) {
|
|
377
|
+
ProtectFs.checkProtected(path, true);
|
|
378
|
+
return nodeFS.open.call(this, path, callback);
|
|
379
|
+
}
|
|
380
|
+
openSync(path, flags, mode) {
|
|
381
|
+
ProtectFs.checkProtected(path, true);
|
|
382
|
+
return nodeFS.openSync.call(this, path, flags, mode);
|
|
383
|
+
}
|
|
384
|
+
truncate(path, callback) {
|
|
385
|
+
ProtectFs.checkProtected(path, false);
|
|
386
|
+
return nodeFS.truncate.call(this, path, callback || ((_err) => { }));
|
|
387
|
+
}
|
|
388
|
+
truncateSync(path) {
|
|
389
|
+
ProtectFs.checkProtected(path, false);
|
|
390
|
+
return nodeFS.truncateSync.call(this, path);
|
|
391
|
+
}
|
|
392
|
+
exists(path, callback) {
|
|
393
|
+
ProtectFs.checkProtected(path, true);
|
|
394
|
+
return nodeFS.exists.call(this, path, callback);
|
|
395
|
+
}
|
|
396
|
+
existsSync(path) {
|
|
397
|
+
ProtectFs.checkProtected(path, true);
|
|
398
|
+
return nodeFS.existsSync.call(this, path);
|
|
399
|
+
}
|
|
400
|
+
stat(path, options, callback) {
|
|
401
|
+
ProtectFs.checkProtected(path, true);
|
|
402
|
+
if (typeof callback === 'function') {
|
|
403
|
+
// @ts-expect-error should work
|
|
404
|
+
return nodeFS.stat.call(this, path, options, callback);
|
|
405
|
+
}
|
|
406
|
+
// @ts-expect-error should work
|
|
407
|
+
return nodeFS.stat.call(this, path, options);
|
|
408
|
+
}
|
|
409
|
+
statSync(path, options) {
|
|
410
|
+
ProtectFs.checkProtected(path, true);
|
|
411
|
+
return nodeFS.statSync.call(this, path, options);
|
|
412
|
+
}
|
|
413
|
+
utimes(path, atime, mtime, callback) {
|
|
414
|
+
ProtectFs.checkProtected(path, false);
|
|
415
|
+
return nodeFS.utimes.call(this, path, atime, mtime, callback || ((_err) => { }));
|
|
416
|
+
}
|
|
417
|
+
utimesSync(path, atime, mtime) {
|
|
418
|
+
ProtectFs.checkProtected(path, false);
|
|
419
|
+
return nodeFS.utimesSync.call(this, path, atime, mtime);
|
|
420
|
+
}
|
|
421
|
+
readdir(path, options, callback) {
|
|
422
|
+
ProtectFs.checkProtected(path, true);
|
|
423
|
+
if (typeof callback === 'function') {
|
|
424
|
+
return nodeFS.readdir.call(this, path, options, callback);
|
|
425
|
+
}
|
|
426
|
+
// @ts-expect-error should work
|
|
427
|
+
return nodeFS.readdir.call(this, path, options);
|
|
428
|
+
}
|
|
429
|
+
readdirSync(path, options) {
|
|
430
|
+
ProtectFs.checkProtected(path, true);
|
|
431
|
+
// @ts-expect-error should work
|
|
432
|
+
return nodeFS.readdirSync.call(this, path, options);
|
|
433
|
+
}
|
|
434
|
+
createReadStream(path, options) {
|
|
435
|
+
ProtectFs.checkProtected(path, true);
|
|
436
|
+
return nodeFS.createReadStream.call(this, path, options);
|
|
437
|
+
}
|
|
438
|
+
createWriteStream(path, options) {
|
|
439
|
+
ProtectFs.checkProtected(path, false);
|
|
440
|
+
return nodeFS.createWriteStream.call(this, path, options);
|
|
441
|
+
}
|
|
442
|
+
lchmod(path, mode, callback) {
|
|
443
|
+
ProtectFs.checkProtected(path, false);
|
|
444
|
+
return nodeFS.lchmod.call(this, path, mode, callback || ((_err) => { }));
|
|
445
|
+
}
|
|
446
|
+
lchmodSync(path, mode) {
|
|
447
|
+
ProtectFs.checkProtected(path, false);
|
|
448
|
+
return nodeFS.lchmodSync.call(this, path, mode);
|
|
449
|
+
}
|
|
450
|
+
lchown(path, uid, gid, callback) {
|
|
451
|
+
ProtectFs.checkProtected(path, false);
|
|
452
|
+
return nodeFS.lchown.call(this, path, uid, gid, callback || ((_err) => { }));
|
|
453
|
+
}
|
|
454
|
+
lchownSync(path, uid, gid) {
|
|
455
|
+
ProtectFs.checkProtected(path, false);
|
|
456
|
+
return nodeFS.lchownSync.call(this, path, uid, gid);
|
|
457
|
+
}
|
|
458
|
+
link(existingPath, newPath, callback) {
|
|
459
|
+
ProtectFs.checkProtected(existingPath, false);
|
|
460
|
+
ProtectFs.checkProtected(newPath, false);
|
|
461
|
+
return nodeFS.link.call(this, existingPath, newPath, callback || ((_err) => { }));
|
|
462
|
+
}
|
|
463
|
+
linkSync(existingPath, newPath) {
|
|
464
|
+
ProtectFs.checkProtected(existingPath, false);
|
|
465
|
+
ProtectFs.checkProtected(newPath, false);
|
|
466
|
+
return nodeFS.linkSync.call(this, existingPath, newPath);
|
|
467
|
+
}
|
|
468
|
+
lstat(path, options, callback) {
|
|
469
|
+
ProtectFs.checkProtected(path, true);
|
|
470
|
+
if (typeof callback === 'function') {
|
|
471
|
+
// @ts-expect-error should work
|
|
472
|
+
return nodeFS.lstat.call(this, path, options, callback);
|
|
473
|
+
}
|
|
474
|
+
// @ts-expect-error should work
|
|
475
|
+
return nodeFS.lstat.call(this, path, options);
|
|
476
|
+
}
|
|
477
|
+
lstatSync(path, options) {
|
|
478
|
+
ProtectFs.checkProtected(path, true);
|
|
479
|
+
return nodeFS.lstatSync.call(this, path, options);
|
|
480
|
+
}
|
|
481
|
+
lutimes(path, atime, mtime, callback) {
|
|
482
|
+
ProtectFs.checkProtected(path, false);
|
|
483
|
+
return nodeFS.lutimes.call(this, path, atime, mtime, callback || ((_err) => { }));
|
|
484
|
+
}
|
|
485
|
+
lutimesSync(path, atime, mtime) {
|
|
486
|
+
ProtectFs.checkProtected(path, false);
|
|
487
|
+
return nodeFS.lutimesSync.call(this, path, atime, mtime);
|
|
488
|
+
}
|
|
489
|
+
mkdir(path, options, callback) {
|
|
490
|
+
ProtectFs.checkProtected(path, false);
|
|
491
|
+
if (typeof callback === 'function') {
|
|
492
|
+
// @ts-expect-error should work
|
|
493
|
+
return nodeFS.mkdir.call(this, path, options, callback);
|
|
494
|
+
}
|
|
495
|
+
return nodeFS.mkdir.call(this, path, options);
|
|
496
|
+
}
|
|
497
|
+
mkdirSync(path, options) {
|
|
498
|
+
ProtectFs.checkProtected(path, false);
|
|
499
|
+
return nodeFS.mkdirSync.call(this, path, options);
|
|
500
|
+
}
|
|
501
|
+
mkdtemp(prefix, options, callback) {
|
|
502
|
+
ProtectFs.checkProtected(prefix, false);
|
|
503
|
+
if (typeof callback === 'function') {
|
|
504
|
+
// @ts-expect-error should work
|
|
505
|
+
return nodeFS.mkdtemp.call(this, prefix, options, callback);
|
|
506
|
+
}
|
|
507
|
+
return nodeFS.mkdtemp.call(this, prefix, options);
|
|
508
|
+
}
|
|
509
|
+
mkdtempSync(prefix, options) {
|
|
510
|
+
ProtectFs.checkProtected(prefix, false);
|
|
511
|
+
return nodeFS.mkdtempSync.call(this, prefix, options);
|
|
512
|
+
}
|
|
513
|
+
rm(path, options, callback) {
|
|
514
|
+
ProtectFs.checkProtected(path, false);
|
|
515
|
+
if (typeof callback === 'function') {
|
|
516
|
+
return nodeFS.rm.call(this, path, options, callback);
|
|
517
|
+
}
|
|
518
|
+
// @ts-expect-error should work
|
|
519
|
+
return nodeFS.rm.call(this, path, options);
|
|
520
|
+
}
|
|
521
|
+
rmSync(path, options) {
|
|
522
|
+
ProtectFs.checkProtected(path, false);
|
|
523
|
+
return nodeFS.rmSync.call(this, path, options);
|
|
524
|
+
}
|
|
525
|
+
rmdir(path, callback) {
|
|
526
|
+
ProtectFs.checkProtected(path, false);
|
|
527
|
+
if (typeof callback === 'function') {
|
|
528
|
+
return nodeFS.rmdir.call(this, path, callback);
|
|
529
|
+
}
|
|
530
|
+
return nodeFS.rmdirSync.call(this, path);
|
|
531
|
+
}
|
|
532
|
+
rmdirSync(path) {
|
|
533
|
+
ProtectFs.checkProtected(path, false);
|
|
534
|
+
return nodeFS.rmdirSync.call(this, path);
|
|
535
|
+
}
|
|
536
|
+
watch(filename, options, listener) {
|
|
537
|
+
ProtectFs.checkProtected(filename, true);
|
|
538
|
+
if (typeof listener === 'function') {
|
|
539
|
+
// @ts-expect-error should work
|
|
540
|
+
return nodeFS.watch.call(this, filename, options, listener);
|
|
541
|
+
}
|
|
542
|
+
return nodeFS.watch.call(this, filename, options);
|
|
543
|
+
}
|
|
544
|
+
watchFile(filename, listener) {
|
|
545
|
+
ProtectFs.checkProtected(filename, true);
|
|
546
|
+
return nodeFS.watchFile.call(this, filename, listener);
|
|
547
|
+
}
|
|
548
|
+
unwatchFile(filename, listener) {
|
|
549
|
+
ProtectFs.checkProtected(filename, true);
|
|
550
|
+
return nodeFS.unwatchFile.call(this, filename, listener);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
exports.default = ProtectFs;
|
|
554
|
+
//# sourceMappingURL=protectFs.js.map
|