@girs/javascriptcore-6.0 2.40.0-3.2.4 → 2.40.0-3.2.6
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
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|

|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
GJS TypeScript type definitions for JavaScriptCore-6.0, generated from library version 2.40.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v3.2.
|
|
8
|
+
GJS TypeScript type definitions for JavaScriptCore-6.0, generated from library version 2.40.0 using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v3.2.6.
|
|
9
9
|
|
|
10
10
|
WebKitGTK+ is a full-featured port of the WebKit rendering engine, suitable for projects requiring any kind of web integration, from hybrid HTML/CSS applications to full-fledged web browsers. This is the library to use to acces JavaScript from WebKitGTK.
|
|
11
11
|
|
|
@@ -82,6 +82,19 @@ Now you have also type support for this, too:
|
|
|
82
82
|
const JavaScriptCore = imports.gi.JavaScriptCore;
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
+
|
|
86
|
+
### ESM vs. CommonJS
|
|
87
|
+
|
|
88
|
+
GJS supports two different import syntaxes. The new modern ESM syntax and the old global imports syntax.
|
|
89
|
+
|
|
90
|
+
In TypeScript projects for GJS and GNOME Shell extensions, you have the flexibility to use `ESM` syntax and then decide the import syntax for your bundled file. If your bundler is configured to use `CommonJS`, it will convert to the GJS-specific global imports syntax, like `const moduleName = imports.gi[moduleName]`. This is different from the traditional `require` syntax seen in Node.js. The global imports syntax is chosen because it aligns with the CommonJS format supported by NPM, which is used for the generated type definitions and this package.
|
|
91
|
+
|
|
92
|
+
On the other hand, if you configure your bundler to use ESM, it will retain the ESM import syntax. It's crucial to ensure that your bundler is set up to correctly translate and bundle these imports into either CommonJS or ESM format, depending on your project's requirements.
|
|
93
|
+
|
|
94
|
+
This approach is particularly important due to the `@girs` types, which include both `*.cjs `files, using the GJS global imports syntax, and `*.js` files, which utilize the ESM syntax. By appropriately setting up your bundler, you can control which syntax—CommonJS or ESM—is used in your project. The choice of CommonJS in this context is also due to the similarity between the GJS-specific global imports and CommonJS syntax, allowing for easier management and bundling in these specific types of projects.
|
|
95
|
+
|
|
96
|
+
Since GNOME Shell 45, you should only use ESM, even for GNOME Shell extensions. Before that, extensions had to use the global import syntax, unlike normal GJS applications, where ESM has been available for some time.
|
|
97
|
+
|
|
85
98
|
### Bundle
|
|
86
99
|
|
|
87
100
|
Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
2
|
declare module 'gi://JavaScriptCore?version=6.0' {
|
|
4
3
|
import JavaScriptCore60 from '@girs/javascriptcore-6.0';
|
|
5
4
|
export default JavaScriptCore60;
|
|
6
5
|
}
|
|
7
6
|
|
|
7
|
+
declare module 'gi://JavaScriptCore' {
|
|
8
|
+
import JavaScriptCore60 from '@girs/javascriptcore-6.0';
|
|
9
|
+
export default JavaScriptCore60;
|
|
10
|
+
}
|
|
8
11
|
|
|
9
12
|
|
package/javascriptcore-6.0.d.cts
CHANGED
|
@@ -628,6 +628,10 @@ export module Context {
|
|
|
628
628
|
* The #JSCVirtualMachine in which the context was created.
|
|
629
629
|
*/
|
|
630
630
|
virtual_machine?: VirtualMachine | null
|
|
631
|
+
/**
|
|
632
|
+
* The #JSCVirtualMachine in which the context was created.
|
|
633
|
+
*/
|
|
634
|
+
virtualMachine?: VirtualMachine | null
|
|
631
635
|
}
|
|
632
636
|
|
|
633
637
|
}
|
|
@@ -640,6 +644,10 @@ export interface Context {
|
|
|
640
644
|
* The #JSCVirtualMachine in which the context was created.
|
|
641
645
|
*/
|
|
642
646
|
readonly virtual_machine: VirtualMachine
|
|
647
|
+
/**
|
|
648
|
+
* The #JSCVirtualMachine in which the context was created.
|
|
649
|
+
*/
|
|
650
|
+
readonly virtualMachine: VirtualMachine
|
|
643
651
|
|
|
644
652
|
// Owm methods of JavaScriptCore-6.0.JavaScriptCore.Context
|
|
645
653
|
|
package/javascriptcore-6.0.d.ts
CHANGED
|
@@ -630,6 +630,10 @@ module Context {
|
|
|
630
630
|
* The #JSCVirtualMachine in which the context was created.
|
|
631
631
|
*/
|
|
632
632
|
virtual_machine?: VirtualMachine | null
|
|
633
|
+
/**
|
|
634
|
+
* The #JSCVirtualMachine in which the context was created.
|
|
635
|
+
*/
|
|
636
|
+
virtualMachine?: VirtualMachine | null
|
|
633
637
|
}
|
|
634
638
|
|
|
635
639
|
}
|
|
@@ -642,6 +646,10 @@ interface Context {
|
|
|
642
646
|
* The #JSCVirtualMachine in which the context was created.
|
|
643
647
|
*/
|
|
644
648
|
readonly virtual_machine: VirtualMachine
|
|
649
|
+
/**
|
|
650
|
+
* The #JSCVirtualMachine in which the context was created.
|
|
651
|
+
*/
|
|
652
|
+
readonly virtualMachine: VirtualMachine
|
|
645
653
|
|
|
646
654
|
// Owm methods of JavaScriptCore-6.0.JavaScriptCore.Context
|
|
647
655
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@girs/javascriptcore-6.0",
|
|
3
|
-
"version": "2.40.0-3.2.
|
|
3
|
+
"version": "2.40.0-3.2.6",
|
|
4
4
|
"description": "GJS TypeScript type definitions for JavaScriptCore-6.0, generated from library version 2.40.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "javascriptcore-6.0.js",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"test:cjs": "NODE_OPTIONS=--max_old_space_size=9216 tsc --noEmit javascriptcore-6.0.d.cts"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@girs/gjs": "^3.2.
|
|
29
|
-
"@girs/glib-2.0": "^2.78.0-3.2.
|
|
30
|
-
"@girs/gobject-2.0": "^2.78.0-3.2.
|
|
28
|
+
"@girs/gjs": "^3.2.6",
|
|
29
|
+
"@girs/glib-2.0": "^2.78.0-3.2.6",
|
|
30
|
+
"@girs/gobject-2.0": "^2.78.0-3.2.6"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"typescript": "*"
|