Skip to content

Commit 621df51

Browse files
committed
Modularize SqueakJS
1 parent 46c8eb2 commit 621df51

File tree

92 files changed

+75580
-8792
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+75580
-8792
lines changed

README.md

+22-24
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
SqueakJS: A Squeak VM for the Web
2-
=================================
1+
SqueakJS: A Squeak VM for the Web and Node.js
2+
=============================================
33

44
SqueakJS is an HTML5 runtime engine for [Squeak][squeak]</a> Smalltalk written in pure JavaScript by Bert Freudenberg.
55

6-
The interpreter core is in "vm.js" and plugins are in the "plugins" directory. The Just-in-Time compiler is optional ("jit.js") and can be easily replaced with your own. There are two user interfaces: the regular HTML interface lets you use SqueakJS on your own web page. Just include "squeak.js". The other interface provides a visual debugger implemented also in JavaScript using [Lively][lively]. This does not use "squeak.js" but reimplements the UI in Lively Morphic.
6+
The interpreter core is divided in a number of "vm.\*.js" modules, internal plugins in "vm.plugins.\*.js" modules and external plugins in the "plugins" directory. The Just-in-Time compiler is optional ("jit.js") and can be easily replaced with your own.
7+
There are a number of interfaces:
8+
* browser: the regular HTML interface lets you use SqueakJS on your own web page. Just include "squeak.js".
9+
* headless browser: a headless VM. It lets you use SqueakJS in your browser without a direct UI (you can create your own UI with a plugin). Include "squeak\_headless.js" and add an "imageName" parameter to your website URL (eg. https://example.com/my/page.html?imageName=./example.image) or call the Javascript function "fetchImageAndRun('https://example.com/my/example.image')" to start the specified image.
10+
* Node.js: another headless VM. It lets you use SqueakJS as a Node.js application. Just run "node squeak\_node.js <image name>".
711

812
For discussions, please use the [vm-dev mailing list][vm-dev]. Also, please visit the [project home page][homepage]!
913

@@ -16,22 +20,33 @@ Running it
1620
* Or similarly, [Scratch][scratch], also in here.
1721
* Go to the [SqueakJS debugger][debug] page with the Lively interface.
1822

19-
**Run your own Squeak image**
23+
**Run your own Squeak image in the browser**
2024

2125
* Drag an image from your local files into the [launcher][run].
22-
* You can also drag files into the [Lively Debugger][debug] page.
2326
* ... and all the other demo pages (see above) accept dropped images, too.
2427

28+
**Run your own Squeak image from the command line**
29+
30+
* Install a recent version of Node.js
31+
* Run example image: `node squeak\_node.js headless/headless.image`
32+
33+
**Run an interactive shell based on WebSocket communication with Cuis image**
34+
35+
* Install a recent version of Node.js
36+
* Go to [ws][ws] and execute `start\_server.sh` in a first shell and `start\_client.sh` in a second shell.
37+
* After initialization it should be possible to issue Smalltalk statements which will be executed in the Smalltalk image.
38+
* Try commands like: `Object allSubclasses size` `1837468731248764723 * 321653125376153761` `Collection allSubclasses collect: [ :c | c name ]`
39+
2540
**Which Browser**
2641

2742
All modern browsers should work (Chrome, Safari, IE, FireFox), though Chrome performs best currently. Safari on iPad works somewhat. YMMV.
2843
Fixes to improve browser compatibility are highly welcome!
2944

45+
If your browser does not support ES6 modules try the full or headless SqueakJS VM as a single file (aka bundle) in the [dist][dist] directory.
46+
3047

3148
Installing locally
3249
------------------
33-
**Without Lively (simpler)**
34-
3550
* download and unpack the [ZIP archive][zip] (or clone the [github repo][repo])
3651
* serve the SqueakJS directory using a local web server.
3752

@@ -44,23 +59,8 @@ Installing locally
4459
Now Squeak should be running.
4560
The reason for having to run from a web server is because the image is loaded with an XMLHttpRequest which does not work with a file URL. Alternatively, you could just open SqueakJS/run/index.html and drop in a local image.
4661

47-
**In Lively (nicer for debugging)**
48-
49-
* install [Lively][lively]
50-
* inside the Lively directory, make a "users/bert" folder and put the SqueakJS directory there
51-
* open the blank.html page using your web browser
52-
* get a Squeak morph from the PartsBin
53-
* save the world under a different name
54-
5562
How to modify it
5663
----------------
57-
**In Lively**
58-
59-
* if you installed with Lively, use that to change the code
60-
* all changes take effect immediately
61-
62-
**Without Lively**
63-
6464
* use any text editor
6565
* you have to reload the page for your changes to take effect
6666

@@ -93,9 +93,7 @@ There's a gazillion exciting things to do :)
9393
[mini]: http://bertfreudenberg.github.io/SqueakJS/demo/simple.html
9494
[etoys]: http://bertfreudenberg.github.io/SqueakJS/etoys/
9595
[scratch]: http://bertfreudenberg.github.io/SqueakJS/scratch/
96-
[debug]: http://lively-web.org/users/bert/squeak.html
9796
[zip]: https://github.com/bertfreudenberg/SqueakJS/archive/master.zip
98-
[lively]: https://github.com/LivelyKernel/LivelyKernel
9997
[pullreq]: https://help.github.com/articles/using-pull-requests
10098

10199

benchmark/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
TARGET=../gh-pages/benchmark
77
MANIFEST=$(TARGET)/offline.appcache
8-
FILES=../squeak.js ../vm.js ../jit.js ../plugins/*.js benchmark.html benchmark.css benchmark.js benchmark.image \
9-
../lib/lz-string.js
8+
FILES=../squeak.js ../globals.js ../vm.*.js ../jit.js ../plugins/*.js benchmark.html benchmark.css benchmark.js benchmark.image \
9+
../lib/lz-string.js ../lib/jszip.js ../lib/sha1.js
1010
EXTRA=
1111

1212
$(MANIFEST): Makefile $(TARGET)

benchmark/benchmark.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<title>SqueakJS Benchmarks</title>
2626
<link rel="stylesheet" href="benchmark.css">
2727
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
28-
<script src="../squeak.js"></script>
28+
<script type="module" src="../squeak.js"></script>
2929
<script src="benchmark.js"></script>
3030

3131
</head>

demo/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
TARGET=../gh-pages/demo
77
MANIFEST=$(TARGET)/offline.appcache
8-
FILES=../squeak.js ../vm.js ../jit.js ../plugins/*.js \
8+
FILES=../squeak.js ../globals.js ../vm.*.js ../jit.js ../plugins/*.js \
99
simple.html simple.css simple.js SimplePlugin.js \
1010
squeakjs.image squeakjs.changes JSBridge.st icon.png \
11-
../lib/lz-string.js ../lib/gh-fork-ribbon.css \
11+
../lib/lz-string.js ../lib/jszip.js ../lib/sha1.js ../lib/gh-fork-ribbon.css \
1212
../lib/addtohomescreen.css ../lib/addtohomescreen.js
1313
EXTRA=
1414

demo/simple.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<script src="../lib/addtohomescreen.js"></script>
3636

3737
<link rel="stylesheet" href="simple.css">
38-
<script src="../squeak.js"></script>
38+
<script type="module" src="../squeak.js"></script>
3939
<script src="simple.js"></script>
4040
<script src="SimplePlugin.js"></script>
4141

0 commit comments

Comments
 (0)