stephan cab9574668 Ensure that the OPFS VFS's xOpen() writes back the read-only flag to the output flags. Resolves the problem reported in [forum:cf37d5ff1182c31081 | forum post cf37d5ff1182c31081]. | 1 月之前 | |
---|---|---|
.. | ||
EXPORTED_FUNCTIONS.sqlite3-core | 4 月之前 | |
EXPORTED_FUNCTIONS.sqlite3-extras | 4 月之前 | |
EXPORTED_FUNCTIONS.sqlite3-see | 1 年之前 | |
EXPORTED_RUNTIME_METHODS.sqlite3-api | 2 年之前 | |
README.md | 10 月之前 | |
extern-post-js.c-pp.js | 1 年之前 | |
extern-pre-js.js | 2 年之前 | |
post-js-footer.js | 2 年之前 | |
post-js-header.js | 10 月之前 | |
pre-js.c-pp.js | 2 月之前 | |
sqlite3-api-cleanup.js | 1 年之前 | |
sqlite3-api-glue.c-pp.js | 4 月之前 | |
sqlite3-api-oo1.c-pp.js | 4 月之前 | |
sqlite3-api-prologue.js | 4 月之前 | |
sqlite3-api-worker1.c-pp.js | 4 月之前 | |
sqlite3-license-version-header.js | 1 年之前 | |
sqlite3-opfs-async-proxy.js | 1 月之前 | |
sqlite3-vfs-helper.c-pp.js | 10 月之前 | |
sqlite3-vfs-opfs-sahpool.c-pp.js | 1 月之前 | |
sqlite3-vfs-opfs.c-pp.js | 1 月之前 | |
sqlite3-vtab-helper.c-pp.js | 4 月之前 | |
sqlite3-wasm.c | 1 月之前 | |
sqlite3-worker1-promiser.c-pp.js | 6 月之前 | |
sqlite3-worker1.c-pp.js | 11 月之前 |
This is the README for the files sqlite3-*.js
and
sqlite3-wasm.c
. This collection of files is used to build a
single-file distribution of the sqlite3 WASM API. It is broken into
multiple JS files because:
To facilitate including or excluding certain components for
specific use cases. e.g. by removing sqlite3-api-oo1.js
if the
OO#1 API is not needed.
To facilitate modularizing the pieces for use in different WASM
build environments. e.g. the files post-js-*.js
are for use with
Emscripten's --post-js
feature, and nowhere else.
Certain components must be in their own standalone files in order to be loaded as JS Workers.
Note that the structure described here is the current state of things, as of this writing, but is not set in stone forever and may change at any time.
The overall idea is that the following files get concatenated together, in the listed order, the resulting file is loaded by a browser client:
sqlite3-api-prologue.js
\../common/whwasmutil.js
\../jaccwabyt/jaccwabyt.js
\sqlite3-api-glue.js
\sqlite3-api-prologue.js
. Most of these pieces
related to populating the sqlite3.capi.wasm
object. This file
also deletes most global-scope symbols the above files create,
effectively moving them into the scope being used for initializing
the API.<build>/sqlite3-api-build-version.js
\sqlite3.version
object. This part is not critical, but records the
version of the library against which this module was built.sqlite3-api-oo1.js
\sqlite3-api-worker1.js
\sqlite3-worker1.js
\sqlite3-api-worker1.js
.sqlite3-worker1-promiser.js
\sqlite3-vfs-helper.js
\sqlite3.vfs
namespace, which contain helpers for use
by downstream code which creates sqlite3_vfs
implementations.sqlite3-vtab-helper.js
\sqlite3.vtab
namespace, which contain helpers for use
by downstream code which creates sqlite3_module
implementations.sqlite3-vfs-opfs.c-pp.js
\sqlite3-opfs-async-proxy.js
\sqlite3-vfs-opfs-sahpool.c-pp.js
\sqlite3-api-cleanup.js
\Files with the extension .c-pp.js
are intended to be processed
with c-pp
, noting that such preprocessing may be applied
after all of the relevant files are concatenated. That extension is
used primarily to keep the code maintainers cognisant of the fact that
those files contain constructs which may not run as-is in any given
JavaScript environment.
The build process glues those files together, resulting in
sqlite3-api.js
, which is everything except for the
pre/post-js-*.js
files, and sqlite3.js
, which is the
Emscripten-generated amalgamated output and includes the
pre/post-js-*.js
parts, as well as the Emscripten-provided module
loading pieces.
The non-JS outlier file is sqlite3-wasm.c
: it is a proxy for
sqlite3.c
which #include
's that file and adds a couple more
WASM-specific helper functions, at least one of which requires access
to private/static sqlite3.c
internals. sqlite3.wasm
is compiled
from this file rather than sqlite3.c
.
The following files are part of the build process but are injected
into the build-generated sqlite3.js
along with sqlite3-api.js
.
extern-pre-js.js
\--extern-pre-js
flag. As of this writing, that file is only used for experimentation
purposes and holds no code relevant to the production deliverables.pre-js.c-pp.js
\--pre-js
flag. This
file is intended as a place to override certain Emscripten behavior
before it starts up, but corner-case Emscripten bugs keep that from
being a reality.post-js-header.js
\--post-js
input. It opens up
a lexical scope by starting a post-run handler for Emscripten.post-js-footer.js
\--post-js
input. This closes
off the lexical scope opened by post-js-header.js
.extern-post-js.c-pp.js
\--extern-post-js
flag. This file overwrites the Emscripten-installed
sqlite3InitModule()
function with one which, after the module is
loaded, also initializes the asynchronous parts of the sqlite3
module. For example, the OPFS VFS support.Certain files in the build require preprocessing to filter in/out
parts which differ between vanilla JS, ES6 Modules, and node.js
builds. The preprocessor application itself is in
c-pp.c
and the complete technical details
of such preprocessing are maintained in
GNUMakefile
.