Skip to content

Commit 98432fa

Browse files
committed
breaking change bootstraping with URL
1 parent 8837d2b commit 98432fa

File tree

6 files changed

+45
-37
lines changed

6 files changed

+45
-37
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
## 1.0.0-beta.15
2+
### Breaking
3+
* bootstrap URL now require full url to the file with standard library
24
### Features
35
* improve performance of `**` operator when JS support exponential operator
46
* add alias for `string-join` and `string-split`

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![npm](https://img.shields.io/badge/npm-1.0.0%E2%80%93beta.14-blue.svg)](https://www.npmjs.com/package/@jcubic/lips)
44
![1.0.0 Complete](https://img.shields.io/github/milestones/progress-percent/jcubic/lips/1?label=1.0.0%20Complete)
5-
[![travis](https://travis-ci.com/jcubic/lips.svg?branch=devel&3eb8068c8fad429f5c22fd55d377c124eb7f2bd7)](https://travis-ci.com/jcubic/lips)
5+
[![travis](https://travis-ci.com/jcubic/lips.svg?branch=devel&8837d2bfdf049e9c524fa4207b757da3adefe674)](https://travis-ci.com/jcubic/lips)
66
[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=devel&c4718a7f131af9e8661ca26097f3db4b)](https://coveralls.io/github/jcubic/lips?branch=devel)
77
[![Join Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jcubic/lips)
88
[![GitHub license](https://img.shields.io/github/license/jcubic/lips.svg)](https://github.com/jcubic/lips/blob/master/LICENSE)
@@ -109,10 +109,22 @@ on first script tag with `text/x-scheme` type. By default it will use CDN from
109109
[jsdelivr](https://www.jsdelivr.com/). To load each file using builtin load function
110110
(that will fetch the file using AJAX and evaluate it).
111111

112-
```
112+
```html
113113
<script src="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/dist/lips.min.js" bootstrap></script>
114114
```
115115

116+
You can also specify the path where LIPS should search for standard library.
117+
118+
```html
119+
<script src="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/dist/lips.min.js"
120+
bootstrap="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/dist/std.xcb">
121+
</script>
122+
```
123+
124+
You can use `bootstrap="./std.xcb"` if there is `std.xcb` file in local directory.
125+
You can also bootstrap with `std.scm` or `std.min.scm` but xcb file is the fastest,
126+
because it's already parsed and compiled into binary format.
127+
116128
## Running LIPS programmatically
117129

118130
```javascript

dist/lips.js

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* Copyright (c) 2014-present, Facebook, Inc.
3232
* released under MIT license
3333
*
34-
* build: Thu, 28 Oct 2021 09:47:41 +0000
34+
* build: Thu, 28 Oct 2021 10:14:28 +0000
3535
*/
3636
(function (global, factory) {
3737
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -4995,7 +4995,7 @@
49954995
* The rationalize algorithm is by Per M.A. Bothner, Alan Bawden and Marc Feeley.
49964996
* source: Kawa, C-Gambit
49974997
*
4998-
* Build time: Thu, 28 Oct 2021 09:47:41 +0000
4998+
* Build time: Thu, 28 Oct 2021 10:14:28 +0000
49994999
*/
50005000
var _excluded = ["token"],
50015001
_excluded2 = ["stderr", "stdin", "stdout"];
@@ -18103,27 +18103,18 @@
1810318103

1810418104
function bootstrap() {
1810518105
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
18106-
var files = ['dist/std.xcb'];
18106+
var std = 'dist/std.xcb';
1810718107

1810818108
if (url === '') {
1810918109
if (is_dev()) {
18110-
url = 'https://cdn.jsdelivr.net/gh/jcubic/lips@devel/';
18110+
url = "https://cdn.jsdelivr.net/gh/jcubic/lips@devel/".concat(std);
1811118111
} else {
18112-
url = "https://cdn.jsdelivr.net/npm/@jcubic/lips@".concat(lips.version, "/");
18112+
url = "https://cdn.jsdelivr.net/npm/@jcubic/lips@".concat(lips.version, "/").concat(std);
1811318113
}
18114-
} else if (!url.match(/\/$/)) {
18115-
url += '/';
1811618114
}
1811718115

1811818116
var load = global_env.get('load');
18119-
return function next() {
18120-
if (files.length) {
18121-
var name = files.shift();
18122-
return load.call(user_env, [url, name].join(''), global_env).then(next);
18123-
} else {
18124-
return Promise.resolve();
18125-
}
18126-
}();
18117+
return load.call(user_env, url, global_env);
1812718118
} // -------------------------------------------------------------------------
1812818119

1812918120

@@ -18583,10 +18574,10 @@
1858318574

1858418575
var banner = function () {
1858518576
// Rollup tree-shaking is removing the variable if it's normal string because
18586-
// obviously 'Thu, 28 Oct 2021 09:47:41 +0000' == '{{' + 'DATE}}'; can be removed
18577+
// obviously 'Thu, 28 Oct 2021 10:14:28 +0000' == '{{' + 'DATE}}'; can be removed
1858718578
// but disablig Tree-shaking is adding lot of not used code so we use this
1858818579
// hack instead
18589-
var date = LString('Thu, 28 Oct 2021 09:47:41 +0000').valueOf();
18580+
var date = LString('Thu, 28 Oct 2021 10:14:28 +0000').valueOf();
1859018581

1859118582
var _date = date === '{{' + 'DATE}}' ? new Date() : new Date(date);
1859218583

@@ -18632,7 +18623,7 @@
1863218623
var lips = {
1863318624
version: 'DEV',
1863418625
banner: banner,
18635-
date: 'Thu, 28 Oct 2021 09:47:41 +0000',
18626+
date: 'Thu, 28 Oct 2021 10:14:28 +0000',
1863618627
exec: exec,
1863718628
// unwrap async generator into Promise<Array>
1863818629
parse: compose(uniterate_async, parse),

dist/lips.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lips.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10015,25 +10015,16 @@ function is_dev() {
1001510015
}
1001610016
// -------------------------------------------------------------------------
1001710017
function bootstrap(url = '') {
10018-
const files = ['dist/std.xcb'];
10018+
const std = 'dist/std.xcb';
1001910019
if (url === '') {
1002010020
if (is_dev()) {
10021-
url = 'https://cdn.jsdelivr.net/gh/jcubic/lips@devel/';
10021+
url = `https://cdn.jsdelivr.net/gh/jcubic/lips@devel/${std}`;
1002210022
} else {
10023-
url = `https://cdn.jsdelivr.net/npm/@jcubic/lips@${lips.version}/`;
10023+
url = `https://cdn.jsdelivr.net/npm/@jcubic/lips@${lips.version}/${std}`;
1002410024
}
10025-
} else if (!url.match(/\/$/)) {
10026-
url += '/';
1002710025
}
1002810026
var load = global_env.get('load');
10029-
return (function next() {
10030-
if (files.length) {
10031-
const name = files.shift();
10032-
return load.call(user_env, [url, name].join(''), global_env).then(next);
10033-
} else {
10034-
return Promise.resolve();
10035-
}
10036-
})();
10027+
return load.call(user_env, url, global_env);
1003710028
}
1003810029
// -------------------------------------------------------------------------
1003910030
function Worker(url) {

templates/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,22 @@ on first script tag with `text/x-scheme` type. By default it will use CDN from
109109
[jsdelivr](https://www.jsdelivr.com/). To load each file using builtin load function
110110
(that will fetch the file using AJAX and evaluate it).
111111

112-
```
112+
```html
113113
<script src="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/dist/lips.min.js" bootstrap></script>
114114
```
115115

116+
You can also specify the path where LIPS should search for standard library.
117+
118+
```html
119+
<script src="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/dist/lips.min.js"
120+
bootstrap="https://cdn.jsdelivr.net/npm/@jcubic/lips@beta/dist/std.xcb">
121+
</script>
122+
```
123+
124+
You can use `bootstrap="./std.xcb"` if there is `std.xcb` file in local directory.
125+
You can also bootstrap with `std.scm` or `std.min.scm` but xcb file is the fastest,
126+
because it's already parsed and compiled into binary format.
127+
116128
## Running LIPS programmatically
117129

118130
```javascript

0 commit comments

Comments
 (0)