myjsbook 1.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/LICENSE +201 -0
- package/README.md +263 -0
- package/package.json +38 -0
- package/public/app.js +6686 -0
- package/public/components/constants.js +421 -0
- package/public/components/elements.js +118 -0
- package/public/components/state.js +53 -0
- package/public/icons/audio.svg +1 -0
- package/public/icons/azure.svg +1 -0
- package/public/icons/babel.svg +1 -0
- package/public/icons/bun.svg +1 -0
- package/public/icons/bun_light.svg +1 -0
- package/public/icons/c.svg +1 -0
- package/public/icons/chrome.svg +1 -0
- package/public/icons/citation.svg +1 -0
- package/public/icons/claude.svg +1 -0
- package/public/icons/console.svg +1 -0
- package/public/icons/cpp.svg +1 -0
- package/public/icons/css-map.svg +1 -0
- package/public/icons/css.svg +1 -0
- package/public/icons/database.svg +1 -0
- package/public/icons/docker.svg +1 -0
- package/public/icons/document.svg +1 -0
- package/public/icons/ejs.svg +1 -0
- package/public/icons/exe.svg +1 -0
- package/public/icons/favicon.svg +1 -0
- package/public/icons/figma.svg +1 -0
- package/public/icons/firebase.svg +1 -0
- package/public/icons/folder-admin-open.svg +1 -0
- package/public/icons/folder-admin.svg +1 -0
- package/public/icons/folder-api-open.svg +1 -0
- package/public/icons/folder-api.svg +1 -0
- package/public/icons/folder-app-open.svg +1 -0
- package/public/icons/folder-app.svg +1 -0
- package/public/icons/folder-archive-open.svg +1 -0
- package/public/icons/folder-archive.svg +1 -0
- package/public/icons/folder-attachment-open.svg +1 -0
- package/public/icons/folder-attachment.svg +1 -0
- package/public/icons/folder-aws-open.svg +1 -0
- package/public/icons/folder-aws.svg +1 -0
- package/public/icons/folder-backup-open.svg +1 -0
- package/public/icons/folder-backup.svg +1 -0
- package/public/icons/folder-class-open.svg +1 -0
- package/public/icons/folder-class.svg +1 -0
- package/public/icons/folder-claude-open.svg +1 -0
- package/public/icons/folder-claude.svg +1 -0
- package/public/icons/folder-client-open.svg +1 -0
- package/public/icons/folder-client.svg +1 -0
- package/public/icons/folder-command-open.svg +1 -0
- package/public/icons/folder-command.svg +1 -0
- package/public/icons/folder-components-open.svg +1 -0
- package/public/icons/folder-components.svg +1 -0
- package/public/icons/folder-config-open.svg +1 -0
- package/public/icons/folder-config.svg +1 -0
- package/public/icons/folder-connection-open.svg +1 -0
- package/public/icons/folder-connection.svg +1 -0
- package/public/icons/folder-console-open.svg +1 -0
- package/public/icons/folder-console.svg +1 -0
- package/public/icons/folder-container-open.svg +1 -0
- package/public/icons/folder-container.svg +1 -0
- package/public/icons/folder-content-open.svg +1 -0
- package/public/icons/folder-content.svg +1 -0
- package/public/icons/folder-context-open.svg +1 -0
- package/public/icons/folder-context.svg +1 -0
- package/public/icons/folder-controller-open.svg +1 -0
- package/public/icons/folder-controller.svg +1 -0
- package/public/icons/folder-core-open.svg +1 -0
- package/public/icons/folder-core.svg +1 -0
- package/public/icons/folder-css-open.svg +1 -0
- package/public/icons/folder-css.svg +1 -0
- package/public/icons/folder-custom-open.svg +1 -0
- package/public/icons/folder-custom.svg +1 -0
- package/public/icons/folder-database-open.svg +1 -0
- package/public/icons/folder-database.svg +1 -0
- package/public/icons/folder-decorators-open.svg +1 -0
- package/public/icons/folder-decorators.svg +1 -0
- package/public/icons/folder-desktop-open.svg +1 -0
- package/public/icons/folder-desktop.svg +1 -0
- package/public/icons/folder-dist-open.svg +1 -0
- package/public/icons/folder-dist.svg +1 -0
- package/public/icons/folder-docs-open.svg +1 -0
- package/public/icons/folder-docs.svg +1 -0
- package/public/icons/folder-download-open.svg +1 -0
- package/public/icons/folder-download.svg +1 -0
- package/public/icons/folder-dtos-open.svg +1 -0
- package/public/icons/folder-dtos.svg +1 -0
- package/public/icons/folder-element-open.svg +1 -0
- package/public/icons/folder-element.svg +1 -0
- package/public/icons/folder-environment-open.svg +1 -0
- package/public/icons/folder-environment.svg +1 -0
- package/public/icons/folder-error-open.svg +1 -0
- package/public/icons/folder-error.svg +1 -0
- package/public/icons/folder-event-open.svg +1 -0
- package/public/icons/folder-event.svg +1 -0
- package/public/icons/folder-examples-open.svg +1 -0
- package/public/icons/folder-examples.svg +1 -0
- package/public/icons/folder-expo-open.svg +1 -0
- package/public/icons/folder-expo.svg +1 -0
- package/public/icons/folder-export-open.svg +1 -0
- package/public/icons/folder-export.svg +1 -0
- package/public/icons/folder-features-open.svg +1 -0
- package/public/icons/folder-features.svg +1 -0
- package/public/icons/folder-filter-open.svg +1 -0
- package/public/icons/folder-filter.svg +1 -0
- package/public/icons/folder-firebase-open.svg +1 -0
- package/public/icons/folder-firebase.svg +1 -0
- package/public/icons/folder-firestore-open.svg +1 -0
- package/public/icons/folder-firestore.svg +1 -0
- package/public/icons/folder-font-open.svg +1 -0
- package/public/icons/folder-font.svg +1 -0
- package/public/icons/folder-functions-open.svg +1 -0
- package/public/icons/folder-functions.svg +1 -0
- package/public/icons/folder-gemini-ai-open.svg +1 -0
- package/public/icons/folder-gemini-ai.svg +1 -0
- package/public/icons/folder-git-open.svg +1 -0
- package/public/icons/folder-git.svg +1 -0
- package/public/icons/folder-github-open.svg +1 -0
- package/public/icons/folder-github.svg +1 -0
- package/public/icons/folder-helper-open.svg +1 -0
- package/public/icons/folder-helper.svg +1 -0
- package/public/icons/folder-home-open.svg +1 -0
- package/public/icons/folder-home.svg +1 -0
- package/public/icons/folder-icons-open.svg +1 -0
- package/public/icons/folder-icons.svg +1 -0
- package/public/icons/folder-images-open.svg +1 -0
- package/public/icons/folder-images.svg +1 -0
- package/public/icons/folder-interface-open.svg +1 -0
- package/public/icons/folder-interface.svg +1 -0
- package/public/icons/folder-ios-open.svg +1 -0
- package/public/icons/folder-ios.svg +1 -0
- package/public/icons/folder-java-open.svg +1 -0
- package/public/icons/folder-java.svg +1 -0
- package/public/icons/folder-javascript-open.svg +1 -0
- package/public/icons/folder-javascript.svg +1 -0
- package/public/icons/folder-middleware-open.svg +1 -0
- package/public/icons/folder-middleware.svg +1 -0
- package/public/icons/folder-migrations-open.svg +1 -0
- package/public/icons/folder-migrations.svg +1 -0
- package/public/icons/folder-other-open.svg +1 -0
- package/public/icons/folder-other.svg +1 -0
- package/public/icons/folder-packages-open.svg +1 -0
- package/public/icons/folder-packages.svg +1 -0
- package/public/icons/folder-pdf-open.svg +1 -0
- package/public/icons/folder-pdf.svg +1 -0
- package/public/icons/folder-plugin-open.svg +1 -0
- package/public/icons/folder-plugin.svg +1 -0
- package/public/icons/folder-project-open.svg +1 -0
- package/public/icons/folder-project.svg +1 -0
- package/public/icons/folder-public-open.svg +1 -0
- package/public/icons/folder-public.svg +1 -0
- package/public/icons/folder-python-open.svg +1 -0
- package/public/icons/folder-python.svg +1 -0
- package/public/icons/folder-repository-open.svg +1 -0
- package/public/icons/folder-repository.svg +1 -0
- package/public/icons/folder-routes-open.svg +1 -0
- package/public/icons/folder-routes.svg +1 -0
- package/public/icons/folder-rules-open.svg +1 -0
- package/public/icons/folder-rules.svg +1 -0
- package/public/icons/folder-sass-open.svg +1 -0
- package/public/icons/folder-sass.svg +1 -0
- package/public/icons/folder-scripts-open.svg +1 -0
- package/public/icons/folder-scripts.svg +1 -0
- package/public/icons/folder-server-open.svg +1 -0
- package/public/icons/folder-server.svg +1 -0
- package/public/icons/folder-serverless-open.svg +1 -0
- package/public/icons/folder-serverless.svg +1 -0
- package/public/icons/folder-skills-open.svg +1 -0
- package/public/icons/folder-skills.svg +1 -0
- package/public/icons/folder-src-open.svg +1 -0
- package/public/icons/folder-src.svg +1 -0
- package/public/icons/folder-stack-open.svg +1 -0
- package/public/icons/folder-stack.svg +1 -0
- package/public/icons/folder-store-open.svg +1 -0
- package/public/icons/folder-store.svg +1 -0
- package/public/icons/folder-supabase-open.svg +1 -0
- package/public/icons/folder-supabase.svg +1 -0
- package/public/icons/folder-svg-open.svg +1 -0
- package/public/icons/folder-svg.svg +1 -0
- package/public/icons/folder-target-open.svg +1 -0
- package/public/icons/folder-target.svg +1 -0
- package/public/icons/folder-tasks-open.svg +1 -0
- package/public/icons/folder-tasks.svg +1 -0
- package/public/icons/folder-temp-open.svg +1 -0
- package/public/icons/folder-temp.svg +1 -0
- package/public/icons/folder-template-open.svg +1 -0
- package/public/icons/folder-template.svg +1 -0
- package/public/icons/folder-test-open.svg +1 -0
- package/public/icons/folder-test.svg +1 -0
- package/public/icons/folder-tools-open.svg +1 -0
- package/public/icons/folder-tools.svg +1 -0
- package/public/icons/folder-typescript-open.svg +1 -0
- package/public/icons/folder-typescript.svg +1 -0
- package/public/icons/folder-ui-open.svg +1 -0
- package/public/icons/folder-ui.svg +1 -0
- package/public/icons/folder-upload-open.svg +1 -0
- package/public/icons/folder-upload.svg +1 -0
- package/public/icons/folder-utils-open.svg +1 -0
- package/public/icons/folder-utils.svg +1 -0
- package/public/icons/folder-video-open.svg +1 -0
- package/public/icons/folder-video.svg +1 -0
- package/public/icons/folder-views-open.svg +1 -0
- package/public/icons/folder-views.svg +1 -0
- package/public/icons/font.svg +1 -0
- package/public/icons/gemini-ai.svg +1 -0
- package/public/icons/gemini.svg +1 -0
- package/public/icons/git.svg +1 -0
- package/public/icons/google.svg +1 -0
- package/public/icons/graphql.svg +1 -0
- package/public/icons/html.svg +1 -0
- package/public/icons/image.svg +1 -0
- package/public/icons/java.svg +1 -0
- package/public/icons/javaclass.svg +1 -0
- package/public/icons/javascript.svg +1 -0
- package/public/icons/jsconfig.svg +1 -0
- package/public/icons/json.svg +1 -0
- package/public/icons/markdown.svg +1 -0
- package/public/icons/nodejs.svg +1 -0
- package/public/icons/nodejs_alt.svg +1 -0
- package/public/icons/nodemon.svg +1 -0
- package/public/icons/npm.svg +1 -0
- package/public/icons/pdf.svg +1 -0
- package/public/icons/prettier.svg +1 -0
- package/public/icons/prisma.svg +1 -0
- package/public/icons/python.svg +1 -0
- package/public/icons/react.svg +1 -0
- package/public/icons/react_ts.svg +1 -0
- package/public/icons/readme.svg +1 -0
- package/public/icons/remark.svg +1 -0
- package/public/icons/sass.svg +1 -0
- package/public/icons/svg.svg +1 -0
- package/public/icons/tailwindcss.svg +1 -0
- package/public/icons/typescript-def.svg +1 -0
- package/public/icons/typescript.svg +1 -0
- package/public/icons/zip.svg +1 -0
- package/public/index.html +1342 -0
- package/public/styles.css +4736 -0
- package/src/cli.js +175 -0
- package/src/lib/files.js +143 -0
- package/src/lib/notebook.js +141 -0
- package/src/lib/package-exports.js +331 -0
- package/src/lib/session.js +1003 -0
- package/src/server.js +2232 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
██████╗ ██╗
|
|
5
|
+
██╔═══╝ ███╗ MarsBook
|
|
6
|
+
██║ ╔═╗╚██╗ JavaScript Notebook
|
|
7
|
+
██║ ╚═╝ ╚██╗
|
|
8
|
+
╚██████╗ ╚██╗
|
|
9
|
+
╚═════╝ ╚═╝
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**A local JavaScript & TypeScript notebook — write code in the dark.**
|
|
13
|
+
|
|
14
|
+
[](https://www.npmjs.com/package/marsbook)
|
|
15
|
+
[](https://nodejs.org)
|
|
16
|
+
[](./LICENSE)
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
MarsBook is a **self-hosted, browser-based notebook** for `.ijsnb` files. Monaco editor, persistent Node.js sessions, AI assistance, a built-in terminal, and full filesystem access — all running **locally**, with zero cloud dependency.
|
|
23
|
+
|
|
24
|
+
> No Python. No Jupyter. Just Node.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 🚀 Quick Start
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install -g marsbook
|
|
32
|
+
marsbook
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Open **http://127.0.0.1:3113** in your browser and start coding. MarsBook auto-opens your last notebook, so you're always back where you left off.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 📦 Installation
|
|
40
|
+
|
|
41
|
+
### Global (recommended)
|
|
42
|
+
```bash
|
|
43
|
+
npm install -g marsbook
|
|
44
|
+
marsbook
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Local project (without global install)
|
|
48
|
+
```bash
|
|
49
|
+
npm install marsbook
|
|
50
|
+
npx marsbook # or add to package.json scripts
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
> **Local usage tip:** Add `"notebook": "marsbook"` to your `package.json` `scripts`, then run `npm run notebook` from the project root. This works without any global install.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 🖥️ Usage
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
marsbook # Start in current directory
|
|
63
|
+
marsbook /path/to/my/notebooks # Start with a specific workspace
|
|
64
|
+
marsbook --port 4000 # Custom port
|
|
65
|
+
marsbook --workspace ~/notebooks -p 3200 # Workspace + port
|
|
66
|
+
marsbook --no-open # Skip auto-opening browser
|
|
67
|
+
marsbook --help # Show help
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
# ✨ Features
|
|
73
|
+
|
|
74
|
+
### 🎨 Editor
|
|
75
|
+
|
|
76
|
+
**Monaco Editor** — the same engine that powers VS Code. Full syntax highlighting, IntelliSense, multi-cursor editing, and semantic token coloring in every cell.
|
|
77
|
+
|
|
78
|
+
**TypeScript & JavaScript** — TypeScript is transpiled on the fly using the TypeScript compiler. Interfaces, enums, generics, and type assertions all work out of the box. Switch language per cell independently.
|
|
79
|
+
|
|
80
|
+
**Markdown cells** — write documentation right alongside code, with a clean distraction-free reading view and instant preview. Features:
|
|
81
|
+
- **View mode** — only the rendered markdown is shown, no chrome, no distractions. Double-click anywhere on the cell to switch to edit mode.
|
|
82
|
+
- **Auto-resize** — the editor textarea grows as you type (up to 400px), then scrolls.
|
|
83
|
+
- **Local image support** — embed local workspace images with standard markdown syntax: ``. URL images work too.
|
|
84
|
+
- **Shift+Enter** — confirm edits and return to view mode.
|
|
85
|
+
|
|
86
|
+
**Auto-formatter** — Prettier runs automatically on save, keeping your code clean without moving the cursor.
|
|
87
|
+
|
|
88
|
+
**Fonts & themes** — choose from multiple fonts (Chivo Mono, JetBrains Mono, Chivo, or system default) and adjust font size (10–20px). Six hand-crafted themes included (default: **Antariksha**):
|
|
89
|
+
|
|
90
|
+
| Light Themes | Dark Themes |
|
|
91
|
+
|:---:|:---:|
|
|
92
|
+
| 🌤 Champa | 🌑 Obsidian |
|
|
93
|
+
| 🌊 Varuna | 🌌 **Antariksha** ← default |
|
|
94
|
+
| 🌿 Haritha | 🌲 Vriksha |
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### ⚡ Execution
|
|
99
|
+
|
|
100
|
+
**Persistent sessions** — each notebook runs in its own long-lived Node.js VM. Variables, imports, and state all carry across cells throughout the session.
|
|
101
|
+
|
|
102
|
+
**Shared cell state** — define something in one cell and use it in any cell below. No re-imports needed.
|
|
103
|
+
|
|
104
|
+
**ES Module imports** — use the standard `import` syntax directly in cells:
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
import { readFile } from "node:fs/promises";
|
|
108
|
+
import chalk from "chalk";
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**TypeScript, all the way down:**
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
interface User { name: string; age: number; }
|
|
115
|
+
const greet = (user: User): string => `Hello, ${user.name}!`;
|
|
116
|
+
greet({ name: "Prateek", age: 25 });
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Const protection** — `const` declarations are enforced across cells. Bare reassignments throw a `TypeError`, just like you'd expect.
|
|
120
|
+
|
|
121
|
+
**Execution count** — each cell tracks how many times it's been run.
|
|
122
|
+
|
|
123
|
+
**Cancel execution** — stop any running cell mid-execution instantly.
|
|
124
|
+
|
|
125
|
+
**`setTimeout` / `setInterval` auto-cleanup** — pending timers are auto-cancelled after 10 seconds if a cell finishes without clearing them, with a visible warning in the output.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### 💬 Inline User Input
|
|
130
|
+
|
|
131
|
+
`prompt()` and `input()` pause execution and show a Jupyter-style inline input widget — no blocking browser modal:
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
const name = await prompt("What's your name? ");
|
|
135
|
+
console.log(`Hello, ${name}!`);
|
|
136
|
+
|
|
137
|
+
// Works without explicit await too (auto-injected):
|
|
138
|
+
const city = prompt("Your city: ");
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
### 🖨️ Rich Output
|
|
144
|
+
|
|
145
|
+
The `display` API renders structured output directly inside cells:
|
|
146
|
+
|
|
147
|
+
```js
|
|
148
|
+
display.text("Hello, world!");
|
|
149
|
+
display.markdown("## Hello *markdown*");
|
|
150
|
+
display.html("<b>Bold</b> <i>HTML</i>");
|
|
151
|
+
display.image("https://example.com/photo.png");
|
|
152
|
+
display.image("./local-chart.png"); // local workspace images work too
|
|
153
|
+
display.table([
|
|
154
|
+
{ name: "Alice", score: 95 },
|
|
155
|
+
{ name: "Bob", score: 88 },
|
|
156
|
+
]);
|
|
157
|
+
|
|
158
|
+
// Object-style works too:
|
|
159
|
+
display({ type: "html", html: "<b>Bold HTML</b>" });
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`console.log`, `console.warn`, `console.error`, `console.info`, and `console.table` are all captured and rendered inline with color-coded labels.
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
### 🤖 AI Features
|
|
166
|
+
|
|
167
|
+
MarsBook has AI built in — no external plugin needed.
|
|
168
|
+
|
|
169
|
+
**AI Assistant chat** — a sliding chat panel powered by [Groq](https://console.groq.com), context-aware of your current cell.
|
|
170
|
+
|
|
171
|
+
**AI Prompt cells** — a special cell type that sends a prompt to an LLM and streams the response inline. Each prompt cell has its own model, system prompt, and temperature.
|
|
172
|
+
|
|
173
|
+
**AI inline completions** — get code suggestions as you type in any code cell.
|
|
174
|
+
|
|
175
|
+
**Live model list** — fetches available LLaMA and OpenAI-compatible models from Groq at runtime. Falls back to a curated default list if offline.
|
|
176
|
+
|
|
177
|
+
To enable AI, set `GROQ_API_KEY` before starting:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
export GROQ_API_KEY=your_key_here
|
|
181
|
+
marsbook
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Get a free key at [console.groq.com](https://console.groq.com).
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
### 🖥️ Built-in Terminal
|
|
189
|
+
|
|
190
|
+
A persistent shell panel is built into the UI. Run any command — `ls`, `git`, `node`, `npm` — directly from the notebook interface.
|
|
191
|
+
|
|
192
|
+
- Tracks your working directory across `cd` commands
|
|
193
|
+
- Always starts at your **workspace root** (never jumps into a notebook's subfolder)
|
|
194
|
+
- Auto-refreshes package IntelliSense after `npm install` / `npm uninstall`
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
### 📁 File & Package Management
|
|
199
|
+
|
|
200
|
+
**File explorer** — browse your workspace with VS Code-style chevrons. Supports opening notebooks, viewing images, editing JS/TS files, and previewing PDFs — all without leaving the app.
|
|
201
|
+
|
|
202
|
+
**Workspace file editor** — open any `.js` or `.ts` file in a Monaco editor tab, edit and save it, then run it in the terminal without switching windows.
|
|
203
|
+
|
|
204
|
+
**`npm install` from the UI** — install packages from within a cell. Newly installed packages are importable immediately.
|
|
205
|
+
|
|
206
|
+
**Workspace statistics** — see notebook counts, total file sizes, cell execution counts, Total Number of Cells.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
### 📓 Notebook Management
|
|
211
|
+
|
|
212
|
+
- **Auto-restore** — MarsBook remembers the last notebook you had open and restores it on next launch. First launch opens `startup.ijsnb` automatically.
|
|
213
|
+
- **Multiple notebooks** — open and switch between `.ijsnb` files in the sidebar
|
|
214
|
+
- **Cell operations** — add, delete, duplicate, and reorder cells
|
|
215
|
+
- **Auto-save on reorder** — silently saves when cells are dragged
|
|
216
|
+
- **`Ctrl+S` save** — preserves cursor position and selection across saves
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
### ⌨️ Keyboard Shortcuts
|
|
221
|
+
|
|
222
|
+
| Shortcut | Action |
|
|
223
|
+
|---|---|
|
|
224
|
+
| `Shift + Enter` | Run cell and move to next |
|
|
225
|
+
| `Ctrl / Cmd + S` | Save notebook |
|
|
226
|
+
| `Ctrl / Cmd + Shift + K` | Delete current cell |
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
### Cell Types
|
|
232
|
+
|
|
233
|
+
| Type | Description |
|
|
234
|
+
|---|---|
|
|
235
|
+
| `code` | JavaScript or TypeScript (`language: "javascript"` or `"typescript"`) |
|
|
236
|
+
| `markdown` | Markdown source with live rendered preview |
|
|
237
|
+
| `prompt` | AI prompt cell — streams LLM response inline, with per-cell model, system prompt, and temperature |
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## 🌍 Environment Variables
|
|
242
|
+
|
|
243
|
+
| Variable | Description |
|
|
244
|
+
|---|---|
|
|
245
|
+
| `GROQ_API_KEY` | Enables AI assistant, AI prompt cells, and inline completions |
|
|
246
|
+
| `PORT` | Override the default port (`3113`) |
|
|
247
|
+
| `HOST` | Override the default host (`127.0.0.1`) |
|
|
248
|
+
|
|
249
|
+
You can also set **per-notebook environment variables** in the notebook's Env settings panel — saved inside the `.ijsnb` file and injected into the kernel at runtime.
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## 🔧 Requirements
|
|
254
|
+
|
|
255
|
+
- **Node.js** ≥ 20
|
|
256
|
+
- A modern browser (Chrome, Edge, Firefox, Safari)
|
|
257
|
+
- *(Optional)* A **Groq API key** for AI features — free at [console.groq.com](https://console.groq.com)
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## 📜 License
|
|
262
|
+
|
|
263
|
+
MIT — use it, fork it, ship it.
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "myjsbook",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "A local JavaScript/TypeScript and Node.js notebook runtime for .ijsnb files.",
|
|
6
|
+
"bin": {
|
|
7
|
+
"myjsbook": "./src/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"public",
|
|
11
|
+
"src",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"keywords": [
|
|
15
|
+
"notebook",
|
|
16
|
+
"javascript",
|
|
17
|
+
"nodejs",
|
|
18
|
+
"jupyter",
|
|
19
|
+
"repl",
|
|
20
|
+
"marsbook",
|
|
21
|
+
"TypeScript"
|
|
22
|
+
],
|
|
23
|
+
"author": "Mars Book<marsbook.js@email.com>",
|
|
24
|
+
"scripts": {
|
|
25
|
+
"start": "node src/cli.js start"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"acorn": "^8.16.0",
|
|
32
|
+
"dotenv": "^16.6.1",
|
|
33
|
+
"monaco-editor": "^0.55.1",
|
|
34
|
+
"nodemon": "^3.1.14",
|
|
35
|
+
"prettier": "^3.8.1",
|
|
36
|
+
"typescript": "^6.0.2"
|
|
37
|
+
}
|
|
38
|
+
}
|