@gjsify/module 0.35.0 → 0.37.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/lib/esm/index.js +1 -1
- package/package.json +4 -4
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{findPnpManifest as e,loadPnpManifest as t,resolveBareViaPnp as n}from"./pnp.js";import"@girs/gjs";import r from"@girs/gio-2.0";import i from"@girs/glib-2.0";import{readJSON as a,resolve as o}from"@gjsify/utils";const s=`assert.async_hooks.buffer.child_process.cluster.console.constants.crypto.dgram.diagnostics_channel.dns.domain.events.fs.http.http2.https.inspector.module.net.os.path.perf_hooks.process.punycode.querystring.readline.repl.stream.string_decoder.sys.timers.tls.tty.url.util.v8.vm.wasi.worker_threads.zlib`.split(`.`);function isBuiltin(e){let t=e.startsWith(`node:`)?e.slice(5):e,n=t.split(`/`)[0];return s.includes(t)||s.includes(n)}function resolveSymlink(e){let t=e.query_info(`standard::`,r.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null);if(t.get_is_symlink()){let n=t.get_symlink_target(),r=e.get_parent();if(n&&r)return r.resolve_relative_path(n).get_path()}return e.get_path()}function tryJsExtension(e){let t=r.File.new_for_path(e+`.js`);return t.query_exists(null)?t:null}function hasExtension(e){return e.includes(`.`)}function resolvePackageEntry(e){let t=o(e,`package.json`);if(!t.query_exists(null))return null;let n=a(t.get_path());if(n.exports!==void 0){let t=resolveExportsMap(n.exports,`.`,c);if(t){let n=o(e,t);if(n.query_exists(null))return n.get_path()}}let r=n.main||n.module||`index.js`,i=o(e,r);if(i.query_exists(null))return i.get_path();if(!hasExtension(r)){let e=tryJsExtension(i.get_path());if(e)return e.get_path()}return null}function resolveExportsMap(e,t,n){if(typeof e==`string`)return t===`.`?e:void 0;if(typeof e!=`object`||!e)return;let r=e,i=Object.keys(r).some(e=>e===`.`||e.startsWith(`./`))?r[t]:t===`.`?r:void 0;if(i!=null)return pickConditionalValue(i,n)}function pickConditionalValue(e,t){if(typeof e==`string`)return e;if(typeof e!=`object`||!e)return;let n=e;for(let e of t)if(e in n){let r=pickConditionalValue(n[e],t);if(r!==void 0)return r}if(`default`in n&&!t.includes(`default`))return pickConditionalValue(n.default,t)}const c=[`node`,`import`,`default`];function splitBareSpecifier(e){if(e.startsWith(`@`)){let t=e.indexOf(`/`);if(t===-1)return{pkg:e,subpath:`.`};let n=e.indexOf(`/`,t+1);return n===-1?{pkg:e,subpath:`.`}:{pkg:e.slice(0,n),subpath:`.`+e.slice(n)}}let t=e.indexOf(`/`);return t===-1?{pkg:e,subpath:`.`}:{pkg:e.slice(0,t),subpath:`.`+e.slice(t)}}function fileUrlToPath(e){if(typeof e==`object`&&e&&`href`in e){let t=e;if(t.protocol&&t.protocol!==`file:`)throw TypeError(`The URL must use the file: protocol`);return i.filename_from_uri(t.href)[0]}return typeof e==`string`&&e.startsWith(`file:`)?i.filename_from_uri(e)[0]:String(e)}function resolveBareViaPnpFromCaller(i,a){let o=e(a);if(!o)return null;let s=t(o);if(!s)return null;let c=n(s,i,a);if(!c)return null;let l=r.File.new_for_path(c);return l.query_exists(null)?l:null}function resolveInNodeModules(e,t){let{pkg:n,subpath:i}=splitBareSpecifier(e),o=r.File.new_for_path(t);for(;o.has_parent(null);){let t=o.resolve_relative_path(`node_modules`);if(t.query_exists(null)){let r=t.resolve_relative_path(n);if(r.query_exists(null)){let e=r.resolve_relative_path(`package.json`);if(e.query_exists(null)){let t=a(e.get_path());if(t.exports!==void 0){let e=resolveExportsMap(t.exports,i,c);if(e!==void 0){let t=r.resolve_relative_path(e);if(t.query_exists(null))return t}}}let t=i===`.`?r:r.resolve_relative_path(i.slice(2));if(t.query_exists(null))return t;let n=t.get_basename();if(n&&!hasExtension(n)){let e=tryJsExtension(t.get_path());if(e)return e}}else{let n=t.resolve_relative_path(e);if(n.query_exists(null))return n;let r=n.get_basename();if(r&&!hasExtension(r)){let e=tryJsExtension(n.get_path());if(e)return e}}}o=o.get_parent()}throw Error(`Cannot find module "${e}" - not found in any node_modules directory`)}function resolveModulePath(e,t){if(isBuiltin(e))return e;let n;if(n=e.startsWith(`/`)?o(e):e.startsWith(`.`)?o(t,e):resolveBareViaPnpFromCaller(e,t)??resolveInNodeModules(e,t),e.startsWith(`/`)||e.startsWith(`.`)){if(!n.query_exists(null)){let e=n.get_basename();e&&!hasExtension(e)&&(n=tryJsExtension(n.get_path())??n)}if(!n.query_exists(null))throw Error(`Cannot find module "${e}"`)}let r=resolveSymlink(n),i=n.get_basename();if(i&&!hasExtension(i)){let
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{findPnpManifest as e,loadPnpManifest as t,resolveBareViaPnp as n}from"./pnp.js";import"@girs/gjs";import r from"@girs/gio-2.0";import i from"@girs/glib-2.0";import{readJSON as a,resolve as o}from"@gjsify/utils";const s=`assert.async_hooks.buffer.child_process.cluster.console.constants.crypto.dgram.diagnostics_channel.dns.domain.events.fs.http.http2.https.inspector.module.net.os.path.perf_hooks.process.punycode.querystring.readline.repl.stream.string_decoder.sys.timers.tls.tty.url.util.v8.vm.wasi.worker_threads.zlib`.split(`.`);function isBuiltin(e){let t=e.startsWith(`node:`)?e.slice(5):e,n=t.split(`/`)[0];return s.includes(t)||s.includes(n)}function resolveSymlink(e){let t=e.query_info(`standard::`,r.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,null);if(t.get_is_symlink()){let n=t.get_symlink_target(),r=e.get_parent();if(n&&r)return r.resolve_relative_path(n).get_path()}return e.get_path()}function tryJsExtension(e){let t=r.File.new_for_path(e+`.js`);return t.query_exists(null)?t:null}function hasExtension(e){return e.includes(`.`)}function isDirectory(e){return r.File.new_for_path(e).query_file_type(r.FileQueryInfoFlags.NONE,null)===r.FileType.DIRECTORY}function resolvePackageEntry(e){let t=o(e,`package.json`);if(!t.query_exists(null))return null;let n=a(t.get_path());if(n.exports!==void 0){let t=resolveExportsMap(n.exports,`.`,c);if(t){let n=o(e,t);if(n.query_exists(null))return n.get_path()}}let r=n.main||n.module||`index.js`,i=o(e,r);if(i.query_exists(null))return i.get_path();if(!hasExtension(r)){let e=tryJsExtension(i.get_path());if(e)return e.get_path()}return null}function resolveExportsMap(e,t,n){if(typeof e==`string`)return t===`.`?e:void 0;if(typeof e!=`object`||!e)return;let r=e,i=Object.keys(r).some(e=>e===`.`||e.startsWith(`./`))?r[t]:t===`.`?r:void 0;if(i!=null)return pickConditionalValue(i,n)}function pickConditionalValue(e,t){if(typeof e==`string`)return e;if(typeof e!=`object`||!e)return;let n=e;for(let e of t)if(e in n){let r=pickConditionalValue(n[e],t);if(r!==void 0)return r}if(`default`in n&&!t.includes(`default`))return pickConditionalValue(n.default,t)}const c=[`node`,`import`,`default`];function splitBareSpecifier(e){if(e.startsWith(`@`)){let t=e.indexOf(`/`);if(t===-1)return{pkg:e,subpath:`.`};let n=e.indexOf(`/`,t+1);return n===-1?{pkg:e,subpath:`.`}:{pkg:e.slice(0,n),subpath:`.`+e.slice(n)}}let t=e.indexOf(`/`);return t===-1?{pkg:e,subpath:`.`}:{pkg:e.slice(0,t),subpath:`.`+e.slice(t)}}function fileUrlToPath(e){if(typeof e==`object`&&e&&`href`in e){let t=e;if(t.protocol&&t.protocol!==`file:`)throw TypeError(`The URL must use the file: protocol`);return i.filename_from_uri(t.href)[0]}return typeof e==`string`&&e.startsWith(`file:`)?i.filename_from_uri(e)[0]:String(e)}function resolveBareViaPnpFromCaller(i,a){let o=e(a);if(!o)return null;let s=t(o);if(!s)return null;let c=n(s,i,a);if(!c)return null;let l=r.File.new_for_path(c);return l.query_exists(null)?l:null}function resolveInNodeModules(e,t){let{pkg:n,subpath:i}=splitBareSpecifier(e),o=r.File.new_for_path(t);for(;o.has_parent(null);){let t=o.resolve_relative_path(`node_modules`);if(t.query_exists(null)){let r=t.resolve_relative_path(n);if(r.query_exists(null)){let e=r.resolve_relative_path(`package.json`);if(e.query_exists(null)){let t=a(e.get_path());if(t.exports!==void 0){let e=resolveExportsMap(t.exports,i,c);if(e!==void 0){let t=r.resolve_relative_path(e);if(t.query_exists(null))return t}}}let t=i===`.`?r:r.resolve_relative_path(i.slice(2));if(t.query_exists(null))return t;let n=t.get_basename();if(n&&!hasExtension(n)){let e=tryJsExtension(t.get_path());if(e)return e}}else{let n=t.resolve_relative_path(e);if(n.query_exists(null))return n;let r=n.get_basename();if(r&&!hasExtension(r)){let e=tryJsExtension(n.get_path());if(e)return e}}}o=o.get_parent()}throw Error(`Cannot find module "${e}" - not found in any node_modules directory`)}function resolveModulePath(e,t){if(isBuiltin(e))return e;let n;if(n=e.startsWith(`/`)?o(e):e.startsWith(`.`)?o(t,e):resolveBareViaPnpFromCaller(e,t)??resolveInNodeModules(e,t),e.startsWith(`/`)||e.startsWith(`.`)){if(!n.query_exists(null)){let e=n.get_basename();e&&!hasExtension(e)&&(n=tryJsExtension(n.get_path())??n)}if(!n.query_exists(null))throw Error(`Cannot find module "${e}"`)}let r=resolveSymlink(n),i=n.get_basename();if(i&&!hasExtension(i)){let t=resolvePackageEntry(r);if(t)return t;if(isDirectory(r))throw Error(`Cannot find module "${e}" - ${r} exists but has no resolvable package entry (its package.json exports/main point at a file that does not exist)`)}return r}function requireJsFile(e,t){if(e in t)return t[e];let n=r.File.new_for_path(e),i=n.get_parent().get_path(),a=n.get_basename();if(a.endsWith(`.mjs`))throw Error(`Cannot require .mjs files. Use import instead. Path: "${e}"`);if(a.endsWith(`.cjs`)){let e=o(i,`__gjsify__`+a.replace(/\.cjs$/,`.js`));e.query_exists(null)&&e.delete(null),n.copy(e,r.FileCopyFlags.NONE,null,null),n=e,a=n.get_basename()}let s=globalThis.exports,c=globalThis.module,l={exports:{}};globalThis.exports=l.exports,globalThis.module=l;try{let{searchPath:n}=imports;n.unshift(i),imports[a.replace(/\.(js|cjs)$/,``)],n.shift();let r=l.exports;return t[e]=r,r}finally{globalThis.exports=s,globalThis.module=c}}function createRequire(e){let t=fileUrlToPath(e);if(!t.startsWith(`/`))throw TypeError(`The argument must be a file URL object, file URL string, or absolute path string. Received "${String(e)}"`);let n=i.path_get_dirname(t),r=Object.create(null),o=function require(e){let t=resolveModulePath(e,n);if(t in r)return r[t];if(t.endsWith(`.json`)){let e=a(t);return r[t]=e,e}if(isBuiltin(e))throw Error(`createRequire: Cannot require builtin module "${e}" synchronously in GJS. Use import instead.`);return requireJsFile(t,r)};return o.resolve=function resolve(e){return resolveModulePath(e,n)},o.resolve.paths=e=>null,o.cache=r,o.extensions=Object.create(null),o.main=void 0,o}var l={builtinModules:s,isBuiltin,createRequire};export{s as builtinModules,createRequire,l as default,isBuiltin};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/module",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "Node.js module module for Gjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"@girs/gio-2.0": "^4.1.0",
|
|
42
42
|
"@girs/gjs": "^4.1.0",
|
|
43
43
|
"@girs/glib-2.0": "^4.1.0",
|
|
44
|
-
"@gjsify/utils": "^0.
|
|
44
|
+
"@gjsify/utils": "^0.37.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@gjsify/cli": "^0.
|
|
48
|
-
"@gjsify/unit": "^0.
|
|
47
|
+
"@gjsify/cli": "^0.37.0",
|
|
48
|
+
"@gjsify/unit": "^0.37.0",
|
|
49
49
|
"@types/node": "^25.9.2",
|
|
50
50
|
"typescript": "^6.0.3"
|
|
51
51
|
},
|