@altimateai/extension-components 0.0.1-beta.2 → 0.0.1-beta.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.
@@ -1,53 +1,53 @@
1
- // Copied from https://github.com/microsoft/vscode-jupyter/blob/main/build/ci/postInstall.js
2
- const fs = require("fs");
3
- const path = require("path");
4
-
5
- /**
6
- * In order to get raw kernels working, we reuse the default kernel that jupyterlab ships.
7
- * However it expects to be talking to a websocket which is serializing the messages to strings.
8
- * Our raw kernel is not a web socket and needs to do its own serialization. To do so, we make a copy
9
- * of the default kernel with the serialization stripped out. This is simpler than making a copy of the module
10
- * at runtime.
11
- */
12
- function createJupyterKernelWithoutSerialization() {
13
- var relativePath = path.join(
14
- "node_modules",
15
- "@jupyterlab",
16
- "services",
17
- "lib",
18
- "kernel",
19
- "default.js"
20
- );
21
- var filePath = path.join("", relativePath);
22
- if (!fs.existsSync(filePath)) {
23
- // If installing in extension, we need to go up one more level
24
- filePath = path.join(__dirname, "../../../../", relativePath);
25
- if (!fs.existsSync(filePath)) {
26
- throw new Error(
27
- "Jupyter lab default kernel not found '" +
28
- filePath +
29
- "' (Jupyter Extension post install script)"
30
- );
31
- }
32
- }
33
- var fileContents = fs.readFileSync(filePath, { encoding: "utf8" });
34
- var replacedContents = fileContents
35
- .replace(
36
- /^const serialize =.*$/gm,
37
- "const serialize = { serialize: (a) => a, deserialize: (a) => a };"
38
- )
39
- .replace(
40
- "const owned = team.session === this.clientId;",
41
- "const owned = parentHeader.session === this.clientId;"
42
- );
43
- if (replacedContents === fileContents) {
44
- throw new Error(
45
- "Jupyter lab default kernel cannot be made non serializing"
46
- );
47
- }
48
- var destPath = path.join(path.dirname(filePath), "nonSerializingKernel.js");
49
- fs.writeFileSync(destPath, replacedContents);
50
- console.log(destPath + " file generated (by Jupyter VSC)");
51
- }
52
-
53
- createJupyterKernelWithoutSerialization();
1
+ // Copied from https://github.com/microsoft/vscode-jupyter/blob/main/build/ci/postInstall.js
2
+ const fs = require("fs");
3
+ const path = require("path");
4
+
5
+ /**
6
+ * In order to get raw kernels working, we reuse the default kernel that jupyterlab ships.
7
+ * However it expects to be talking to a websocket which is serializing the messages to strings.
8
+ * Our raw kernel is not a web socket and needs to do its own serialization. To do so, we make a copy
9
+ * of the default kernel with the serialization stripped out. This is simpler than making a copy of the module
10
+ * at runtime.
11
+ */
12
+ function createJupyterKernelWithoutSerialization() {
13
+ var relativePath = path.join(
14
+ "node_modules",
15
+ "@jupyterlab",
16
+ "services",
17
+ "lib",
18
+ "kernel",
19
+ "default.js"
20
+ );
21
+ var filePath = path.join("", relativePath);
22
+ if (!fs.existsSync(filePath)) {
23
+ // If installing in extension, we need to go up one more level
24
+ filePath = path.join(__dirname, "../../../../", relativePath);
25
+ if (!fs.existsSync(filePath)) {
26
+ throw new Error(
27
+ "Jupyter lab default kernel not found '" +
28
+ filePath +
29
+ "' (Jupyter Extension post install script)"
30
+ );
31
+ }
32
+ }
33
+ var fileContents = fs.readFileSync(filePath, { encoding: "utf8" });
34
+ var replacedContents = fileContents
35
+ .replace(
36
+ /^const serialize =.*$/gm,
37
+ "const serialize = { serialize: (a) => a, deserialize: (a) => a };"
38
+ )
39
+ .replace(
40
+ "const owned = team.session === this.clientId;",
41
+ "const owned = parentHeader.session === this.clientId;"
42
+ );
43
+ if (replacedContents === fileContents) {
44
+ throw new Error(
45
+ "Jupyter lab default kernel cannot be made non serializing"
46
+ );
47
+ }
48
+ var destPath = path.join(path.dirname(filePath), "nonSerializingKernel.js");
49
+ fs.writeFileSync(destPath, replacedContents);
50
+ console.log(destPath + " file generated (by Jupyter VSC)");
51
+ }
52
+
53
+ createJupyterKernelWithoutSerialization();
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
- {
2
- "name": "@altimateai/extension-components",
3
- "version": "0.0.1-beta.2",
4
- "type": "module",
5
- "main": "./dist/index.js",
6
- "module": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/AltimateAI/altimate-components.git"
11
- },
12
- "publishConfig": {
13
- "registry": "https://registry.npmjs.org/",
14
- "access": "public"
15
- },
16
- "files": [
17
- "dist",
18
- "dist/postInstall.cjs"
19
- ],
20
- "scripts": {
21
- "postinstall": "node ./dist/postInstall.cjs"
22
- },
23
- "exports": {
24
- ".": {
25
- "import": "./dist/index.js",
26
- "require": "./dist/index.js",
27
- "types": "./dist/index.d.ts"
28
- }
29
- },
30
- "peerDependencies": {
31
- "@jupyterlab/services": "^6.6.7"
32
- }
33
- }
1
+ {
2
+ "name": "@altimateai/extension-components",
3
+ "version": "0.0.1-beta.6",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/AltimateAI/altimate-components.git"
11
+ },
12
+ "publishConfig": {
13
+ "registry": "https://registry.npmjs.org/",
14
+ "access": "public"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "dist/postInstall.cjs"
19
+ ],
20
+ "scripts": {
21
+ "postinstall": "node ./dist/postInstall.cjs"
22
+ },
23
+ "exports": {
24
+ ".": {
25
+ "import": "./dist/index.js",
26
+ "require": "./dist/index.js",
27
+ "types": "./dist/index.d.ts"
28
+ }
29
+ },
30
+ "peerDependencies": {
31
+ "@jupyterlab/services": "^6.6.7"
32
+ }
33
+ }
package/readme.md ADDED
@@ -0,0 +1,11 @@
1
+ ## Installation
2
+
3
+ To install the package, you can use either npm or yarn:
4
+
5
+ ```bash
6
+ # Using npm
7
+ npm install @altimateai/extension-components
8
+
9
+ # Using yarn
10
+ yarn add @altimateai/extension-components
11
+ ```