这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/_sqlite3.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,5 +547,5 @@ void tjs__mod_sqlite3_init(JSContext *ctx, JSValue ns) {
JSValue obj = JS_NewObjectProto(ctx, JS_NULL);
JS_SetPropertyFunctionList(ctx, obj, tjs_sqlite3_funcs, countof(tjs_sqlite3_funcs));

JS_DefinePropertyValueStr(ctx, ns, "_sqlite3", obj, JS_PROP_C_W_E);
JS_DefinePropertyValueStr(ctx, ns, "sqlite3", obj, JS_PROP_C_W_E);
}
5,931 changes: 2,965 additions & 2,966 deletions src/bundles/c/core/core.c

Large diffs are not rendered by default.

56,452 changes: 28,226 additions & 28,226 deletions src/bundles/c/core/polyfills.c

Large diffs are not rendered by default.

562 changes: 281 additions & 281 deletions src/bundles/c/stdlib/sqlite.c

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1294,8 +1294,8 @@ static const JSCFunctionListEntry tjs_fs_funcs[] = {
TJS_CFUNC_DEF("lchown", 3, tjs_fs_lchown),
TJS_CFUNC_DEF("chmod", 2, tjs_fs_chmod),
/* Internal */
TJS_CFUNC_DEF("_mkdirSync", 2, tjs_fs_mkdir_sync),
TJS_CFUNC_DEF("_statSync", 1, tjs_fs_stat_sync),
TJS_CFUNC_DEF("mkdirSync", 2, tjs_fs_mkdir_sync),
TJS_CFUNC_DEF("statSync", 1, tjs_fs_stat_sync),
};

void tjs__mod_fs_init(JSContext *ctx, JSValue ns) {
Expand Down
14 changes: 7 additions & 7 deletions src/js/core/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@ const core = globalThis[Symbol.for('tjs.internal.core')];

const env = new Proxy({}, {
ownKeys() {
return core._envKeys();
return core.envKeys();
},
get(_, prop) {
if (prop === Symbol.toStringTag) {
return JSON.stringify(core._environ(), null, 2);
return JSON.stringify(core.environ(), null, 2);
} else if (prop === 'toJSON') {
return () => core._environ();
return () => core.environ();
} else if (typeof prop === 'string') {
try {
return core._getenv(prop);
return core.getenv(prop);
} catch (_) { /* Ignored. */ }
}

return undefined;
},
set(_, prop, val) {
core._setenv(prop, val);
core.setenv(prop, val);

return true;
},
deleteProperty(_, prop) {
core._unsetenv(prop);
core.unsetenv(prop);

return true;
},
has(_, key) {
return key in core._envKeys();
return key in core.envKeys();
}
});

Expand Down
12 changes: 6 additions & 6 deletions src/js/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,21 +183,21 @@ Object.defineProperty(tjs, 'stderr', {
// Interface for the garbage collection
const _gc_state = {
enabled: true,
threshold: core._gc.getThreshold()
threshold: core.gc.getThreshold()
};

Object.defineProperty(tjs, 'gc', {
enumerable: true,
configurable: false,
writable: false,
value: {
run: () => core._gc.run(),
run: () => core.gc.run(),

set enabled(value) {
if (value) {
core._gc.setThreshold(_gc_state.threshold);
core.gc.setThreshold(_gc_state.threshold);
} else {
core._gc.setThreshold(-1);
core.gc.setThreshold(-1);
}

_gc_state.enabled=value;
Expand All @@ -208,13 +208,13 @@ Object.defineProperty(tjs, 'gc', {

set threshold(value) {
if (_gc_state.enabled) {
core._gc.setThreshold(value);
core.gc.setThreshold(value);
}

_gc_state.threshold = value;
},
get threshold() {
const tmp = core._gc.getThreshold();
const tmp = core.gc.getThreshold();

if (tmp !== -1) {
_gc_state.threshold = tmp;
Expand Down
8 changes: 4 additions & 4 deletions src/js/polyfills/storage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global tjs */

const core = globalThis[Symbol.for('tjs.internal.core')];
const sqlite3 = core._sqlite3;
const sqlite3 = core.sqlite3;

const kStorageMap = Symbol('kStorageMap');

Expand Down Expand Up @@ -220,7 +220,7 @@ function mkdirSync(path, options = { mode: 0o777, recursive: false }) {
const pathModule = globalThis[Symbol.for('tjs.internal.modules.path')];

if (!options.recursive) {
return core._mkdirSync(path, options.mode);
return core.mkdirSync(path, options.mode);
}

const parent = pathModule.dirname(path);
Expand All @@ -232,11 +232,11 @@ function mkdirSync(path, options = { mode: 0o777, recursive: false }) {
mkdirSync(parent, options);

try {
return core._mkdirSync(path, options.mode);
return core.mkdirSync(path, options.mode);
} catch (e) {
// Cannot rely on checking for EEXIST since the OS could throw other errors like EROFS.

const st = core._statSync(path);
const st = core.statSync(path);

if (!st.isDirectory) {
throw e;
Expand Down
2 changes: 1 addition & 1 deletion src/js/stdlib/sqlite.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const core = globalThis[Symbol.for('tjs.internal.core')];
const sqlite3 = core._sqlite3;
const sqlite3 = core.sqlite3;

const kSqlite3Handle = Symbol('kSqlite3Handle');
let controllers;
Expand Down
10 changes: 5 additions & 5 deletions src/os.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,11 +486,11 @@ static const JSCFunctionListEntry tjs_os_funcs[] = {
TJS_CFUNC_DEF("uname", 0, tjs_uname),
TJS_CFUNC_DEF("uptime", 0, tjs_uptime),
TJS_CFUNC_DEF("guessHandle", 1, tjs_guess_handle),
TJS_CFUNC_DEF("_getenv", 0, tjs_getenv),
TJS_CFUNC_DEF("_setenv", 2, tjs_setenv),
TJS_CFUNC_DEF("_unsetenv", 1, tjs_unsetenv),
TJS_CFUNC_DEF("_envKeys", 0, tjs_envKeys),
TJS_CFUNC_DEF("_environ", 0, tjs_environ),
TJS_CFUNC_DEF("getenv", 0, tjs_getenv),
TJS_CFUNC_DEF("setenv", 2, tjs_setenv),
TJS_CFUNC_DEF("unsetenv", 1, tjs_unsetenv),
TJS_CFUNC_DEF("envKeys", 0, tjs_envKeys),
TJS_CFUNC_DEF("environ", 0, tjs_environ),
TJS_CFUNC_DEF("chdir", 1, tjs_chdir),
TJS_CFUNC_DEF("random", 3, tjs_random),
TJS_CFUNC_DEF("cpuInfo", 0, tjs_cpu_info),
Expand Down
2 changes: 1 addition & 1 deletion src/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void tjs__mod_sys_init(JSContext *ctx, JSValue ns) {

JSValue gc = JS_NewObjectProto(ctx, JS_NULL);
JS_SetPropertyFunctionList(ctx, gc, tjs_gc_funcs, countof(tjs_gc_funcs));
JS_DefinePropertyValueStr(ctx, ns, "_gc", gc, 0);
JS_DefinePropertyValueStr(ctx, ns, "gc", gc, JS_PROP_C_W_E);

JS_DefinePropertyValueStr(ctx, ns, "versions", versions, JS_PROP_C_W_E);
JS_DefinePropertyValueStr(ctx, ns, "platform", JS_NewString(ctx, TJS__PLATFORM), JS_PROP_C_W_E);
Expand Down