Compare commits
1 commit
master
...
rnewman/fi
Author | SHA1 | Date | |
---|---|---|---|
|
2577e0d4a7 |
15 changed files with 128 additions and 41 deletions
36
project.clj
36
project.clj
|
@ -47,6 +47,31 @@
|
||||||
}
|
}
|
||||||
:notify-command ["release-node/wrap_bare.sh"]}
|
:notify-command ["release-node/wrap_bare.sh"]}
|
||||||
|
|
||||||
|
:release-addon
|
||||||
|
;; Release builds for use in Firefox add-ons are much like the ones
|
||||||
|
;; for Firefox itself, but they can freely use `console` and must
|
||||||
|
;; `require("chrome")` to get access to Components.
|
||||||
|
{
|
||||||
|
:source-paths ["src/common" "src/browser-common" "src/addon"]
|
||||||
|
:assert false
|
||||||
|
:compiler
|
||||||
|
{
|
||||||
|
:elide-asserts true
|
||||||
|
:externs ["src/browser-common/externs/datomish.js"]
|
||||||
|
:language-in :ecmascript5
|
||||||
|
:language-out :ecmascript5
|
||||||
|
:optimizations :advanced
|
||||||
|
:output-dir "target/release-addon"
|
||||||
|
:output-to "target/release-addon/datomish.bare.js"
|
||||||
|
:output-wrapper false
|
||||||
|
:parallel-build true
|
||||||
|
:preloads [datomish.preload]
|
||||||
|
:pretty-print true
|
||||||
|
:pseudo-names true
|
||||||
|
:static-fns true
|
||||||
|
}
|
||||||
|
:notify-command ["release-addon/wrap_bare.sh"]}
|
||||||
|
|
||||||
:release-browser
|
:release-browser
|
||||||
;; Release builds for use in Firefox must:
|
;; Release builds for use in Firefox must:
|
||||||
;; * Use :optimizations > :none, so that a single file is generated
|
;; * Use :optimizations > :none, so that a single file is generated
|
||||||
|
@ -57,15 +82,16 @@
|
||||||
;; There's no point in generating a source map -- it'll be wrong
|
;; There's no point in generating a source map -- it'll be wrong
|
||||||
;; due to wrapping.
|
;; due to wrapping.
|
||||||
{
|
{
|
||||||
:source-paths ["src/common" "src/browser"]
|
:source-paths ["src/common" "src/browser-common" "src/browser"]
|
||||||
:assert false
|
:assert false
|
||||||
:compiler
|
:compiler
|
||||||
{
|
{
|
||||||
|
:verbose true
|
||||||
:elide-asserts true
|
:elide-asserts true
|
||||||
:externs ["src/browser/externs/datomish.js"]
|
:externs ["src/browser-common/externs/datomish.js"]
|
||||||
:language-in :ecmascript5
|
:language-in :ecmascript5-strict
|
||||||
:language-out :ecmascript5
|
:language-out :ecmascript5-strict
|
||||||
:optimizations :advanced
|
:optimizations :simple
|
||||||
:output-dir "target/release-browser"
|
:output-dir "target/release-browser"
|
||||||
:output-to "target/release-browser/datomish.bare.js"
|
:output-to "target/release-browser/datomish.bare.js"
|
||||||
:output-wrapper false
|
:output-wrapper false
|
||||||
|
|
5
release-addon/README.md
Normal file
5
release-addon/README.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Datomish
|
||||||
|
|
||||||
|
Datomish is a persistent, embedded knowledge base. It's written in ClojureScript, and draws heavily on [DataScript](https://github.com/tonsky/datascript) and [Datomic](http://datomic.com).
|
||||||
|
|
||||||
|
For more info, check out the [project page](https://github.com/mozila/datomish).
|
7
release-addon/wrap_bare.sh
Executable file
7
release-addon/wrap_bare.sh
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
(cat release-browser/wrapper.prefix; cat target/release-browser/datomish.bare.js; cat release-browser/wrapper.suffix) > target/release-browser/datomish.js
|
||||||
|
|
||||||
|
echo "Packed target/release-browser/datomish.js"
|
34
release-addon/wrapper.prefix
Normal file
34
release-addon/wrapper.prefix
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
// Datomish 0.1.0-SNAPSHOT
|
||||||
|
|
||||||
|
(function (definition) {
|
||||||
|
// This file will function properly as a <script> tag, or a module
|
||||||
|
// using CommonJS and NodeJS or RequireJS module formats.
|
||||||
|
|
||||||
|
// Wrapper gratefully adapted from:
|
||||||
|
// https://github.com/kriskowal/q/blob/v1/q.js
|
||||||
|
// https://github.com/swannodette/mori/blob/master/support/wrapper.js
|
||||||
|
// https://github.com/tonsky/datascript/blob/master/release-js/wrapper.js
|
||||||
|
|
||||||
|
// CommonJS
|
||||||
|
if (typeof exports === "object") {
|
||||||
|
module.exports = definition();
|
||||||
|
|
||||||
|
// RequireJS
|
||||||
|
} else if (typeof define === "function" && define.amd) {
|
||||||
|
define(definition);
|
||||||
|
|
||||||
|
// <script>
|
||||||
|
} else {
|
||||||
|
datomish = definition();
|
||||||
|
}
|
||||||
|
})(function () {
|
||||||
|
return function () {
|
||||||
|
|
||||||
|
// Monkeypatch setTimeout so that the Closure Compiler
|
||||||
|
// output can use it in a Sandbox context.
|
||||||
|
var { setTimeout } = require("sdk/timers");
|
||||||
|
this.setTimeout = setTimeout;
|
6
release-addon/wrapper.suffix
Normal file
6
release-addon/wrapper.suffix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
;return this.datomish.js;
|
||||||
|
|
||||||
|
}.call({});
|
||||||
|
|
||||||
|
});
|
|
@ -2,33 +2,28 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
// Datomish 0.1.0-SNAPSHOT
|
this.EXPORTED_SYMBOLS = ["Datomish"];
|
||||||
|
|
||||||
(function (definition) {
|
|
||||||
// This file will function properly as a <script> tag, or a module
|
|
||||||
// using CommonJS and NodeJS or RequireJS module formats.
|
|
||||||
|
|
||||||
// Wrapper gratefully adapted from:
|
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||||
// https://github.com/kriskowal/q/blob/v1/q.js
|
|
||||||
// https://github.com/swannodette/mori/blob/master/support/wrapper.js
|
|
||||||
// https://github.com/tonsky/datascript/blob/master/release-js/wrapper.js
|
|
||||||
|
|
||||||
// CommonJS
|
// So we can polyfill setImmediate.
|
||||||
if (typeof exports === "object") {
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
module.exports = definition();
|
|
||||||
|
|
||||||
// RequireJS
|
var setImmediate = function (callback) {
|
||||||
} else if (typeof define === "function" && define.amd) {
|
let args = new Array(arguments.length - 1);
|
||||||
define(definition);
|
for (let i = 0; i < args.length; i++) {
|
||||||
|
args[i] = arguments[i + 1];
|
||||||
|
}
|
||||||
|
|
||||||
// <script>
|
callback = callback.bind(callback, args);
|
||||||
} else {
|
Services.tm.currentThread.dispatch(callback, Ci.nsIThread.DISPATCH_NORMAL);
|
||||||
datomish = definition();
|
}
|
||||||
}
|
|
||||||
})(function () {
|
|
||||||
return function () {
|
|
||||||
|
|
||||||
// Monkeypatch setTimeout so that the Closure Compiler
|
var console = {
|
||||||
// output can use it in a Sandbox context.
|
log: function (s) {
|
||||||
var { setTimeout } = require("sdk/timers");
|
dump(s);
|
||||||
this.setTimeout = setTimeout;
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.Datomish = (function () {
|
||||||
|
|
|
@ -1,6 +1,2 @@
|
||||||
|
return datomish.js;
|
||||||
;return this.datomish.js;
|
}).call(this);
|
||||||
|
|
||||||
}.call({});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
9
src/addon/datomish/sqlite_module.cljs
Normal file
9
src/addon/datomish/sqlite_module.cljs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
(ns datomish.sqlite-module)
|
||||||
|
|
||||||
|
(def sqlite (.import (aget (js/require "chrome") "Cu") "resource://gre/modules/Sqlite.jsm"))
|
||||||
|
|
||||||
|
(println "Add-on code: sqlite is" (pr-str sqlite))
|
|
@ -10,4 +10,3 @@
|
||||||
[datomish.js-sqlite :as js-sqlite]
|
[datomish.js-sqlite :as js-sqlite]
|
||||||
[datomish.sqlite :as sqlite]
|
[datomish.sqlite :as sqlite]
|
||||||
[datomish.transact :as transact]))
|
[datomish.transact :as transact]))
|
||||||
|
|
|
@ -5,11 +5,8 @@
|
||||||
(ns datomish.sqlitejsm-sqlite
|
(ns datomish.sqlitejsm-sqlite
|
||||||
(:require
|
(:require
|
||||||
[cljs-promises.async]
|
[cljs-promises.async]
|
||||||
[datomish.sqlite :as s]))
|
[datomish.sqlite :as s]
|
||||||
|
[datomish.sqlite-module :refer [sqlite]]))
|
||||||
(def sqlite (.import (aget (js/require "chrome") "Cu") "resource://gre/modules/Sqlite.jsm"))
|
|
||||||
|
|
||||||
(println "sqlite is" (pr-str sqlite))
|
|
||||||
|
|
||||||
;; mozIStorageRow instances expose two methods: getResultByIndex and getResultByName.
|
;; mozIStorageRow instances expose two methods: getResultByIndex and getResultByName.
|
||||||
;; Our code expects to treat rows as associative containers, from keyword to value.
|
;; Our code expects to treat rows as associative containers, from keyword to value.
|
|
@ -6,6 +6,10 @@ var Array = {};
|
||||||
Array.length = 0;
|
Array.length = 0;
|
||||||
Array.isArray = function () {};
|
Array.isArray = function () {};
|
||||||
|
|
||||||
|
var Components = {};
|
||||||
|
Components.utils = {};
|
||||||
|
Components.utils.import = function (name, scope) {};
|
||||||
|
|
||||||
var SqliteStatic = {};
|
var SqliteStatic = {};
|
||||||
|
|
||||||
/**
|
/**
|
9
src/browser/datomish/sqlite_module.cljs
Normal file
9
src/browser/datomish/sqlite_module.cljs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
(ns datomish.sqlite-module)
|
||||||
|
|
||||||
|
(def sqlite (.import (aget js/Components "utils") "resource://gre/modules/Sqlite.jsm"))
|
||||||
|
|
||||||
|
(println "Browser code: sqlite is" (pr-str sqlite))
|
Loading…
Reference in a new issue