Skip to content

Commit babd0a3

Browse files
committed
Add latest compiled assets
1 parent 9d90bb3 commit babd0a3

10 files changed

+324
-81
lines changed

dist/sql-asm-debug.js

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11

22
// We are modularizing this manually because the current modularize setting in Emscripten has some issues:
33
// https://github.com/kripken/emscripten/issues/5820
4-
// This module exports a promise that loads and resolves to the actual sql.js module.
4+
// In addition, When you use emcc's modularization, it still expects to export a global object called `Module`,
5+
// which is able to be used/called before the WASM is loaded.
6+
// The modularization below exports a promise that loads and resolves to the actual sql.js module.
57
// That way, this module can't be used before the WASM is finished loading.
68

7-
8-
// So the first thing that this module does is define a place for the loadedModule to reside
9-
109
// We are going to define a function that a user will call to start loading initializing our Sql.js library
11-
// However, that function might be called multiple times, and on subsequent calls, we want it to return the same module that it's already loaded once before.
10+
// However, that function might be called multiple times, and on subsequent calls, we don't actually want it to instantiate a new instance of the Module
11+
// Instead, we want to return the previously loaded module
1212

13+
// TODO: Make this not declare a global if used in the browser
1314
var initSqlJsPromise = undefined;
1415

1516
var initSqlJs = function (moduleConfig) {
@@ -18,7 +19,7 @@ var initSqlJs = function (moduleConfig) {
1819
return initSqlJsPromise;
1920
}
2021
// If we're here, we've never called this function before
21-
initSqlJsPromise = new Promise((resolveModule) => {
22+
initSqlJsPromise = new Promise((resolveModule, reject) => {
2223

2324
// We are modularizing this manually because the current modularize setting in Emscripten has some issues:
2425
// https://github.com/kripken/emscripten/issues/5820
@@ -47,6 +48,24 @@ var initSqlJs = function (moduleConfig) {
4748
// When Emscripted calls postRun, this promise resolves with the built Module
4849
resolveModule(Module);
4950
});
51+
52+
// There is a section of code in the emcc-generated code below that looks like this:
53+
// (Note that this is lowercase `module`)
54+
// if (typeof module !== 'undefined') {
55+
// module['exports'] = Module;
56+
// }
57+
// When that runs, it's going to overwrite our own modularization export efforts in shell-post.js!
58+
// The only way to tell emcc not to emit it is to pass the MODULARIZE=1 or MODULARIZE_INSTANCE=1 flags,
59+
// but that carries with it additional unnecessary baggage/bugs we don't want either.
60+
// So, we have three options:
61+
// 1) We undefine `module`
62+
// 2) We remember what `module['exports']` was at the beginning of this function and we restore it later
63+
// 3) We write a script to remove those lines of code as part of the Make process.
64+
//
65+
// Since those are the only lines of code that care about module, we will undefine it. It's the most straightforward
66+
// of the options, and has the side effect of reducing emcc's efforts to modify the module if its output were to change in the future.
67+
// That's a nice side effect since we're handling the modularization efforts ourselves
68+
module = undefined;
5069

5170
// The emcc-generated code and shell-post.js code goes below,
5271
// meaning that all of it runs inside of this promise. If anything throws an exception, our promise will abort
@@ -447110,9 +447129,17 @@ run();
447110447129
return initSqlJsPromise;
447111447130
} // The end of our initSqlJs function
447112447131

447113-
// This will allow the module to be used in ES6 or CommonJS
447114-
initSqlJs.default = initSqlJs;
447132+
// This bit below is copied almost exactly from what you get when you use the MODULARIZE=1 flag with emcc
447133+
// However, we don't want to use the emcc modularization. See shell-pre.js
447115447134
if (typeof exports === 'object' && typeof module === 'object'){
447116447135
module.exports = initSqlJs;
447136+
// This will allow the module to be used in ES6 or CommonJS
447137+
module.exports.default = initSqlJs;
447117447138
}
447118-
447139+
else if (typeof define === 'function' && define['amd']) {
447140+
define([], function() { return initSqlJs; });
447141+
}
447142+
else if (typeof exports === 'object'){
447143+
exports["Module"] = initSqlJs;
447144+
}
447145+

dist/sql-asm-memory-growth.js

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

dist/sql-asm.js

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

dist/sql-wasm-debug.js

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11

22
// We are modularizing this manually because the current modularize setting in Emscripten has some issues:
33
// https://github.com/kripken/emscripten/issues/5820
4-
// This module exports a promise that loads and resolves to the actual sql.js module.
4+
// In addition, When you use emcc's modularization, it still expects to export a global object called `Module`,
5+
// which is able to be used/called before the WASM is loaded.
6+
// The modularization below exports a promise that loads and resolves to the actual sql.js module.
57
// That way, this module can't be used before the WASM is finished loading.
68

7-
8-
// So the first thing that this module does is define a place for the loadedModule to reside
9-
109
// We are going to define a function that a user will call to start loading initializing our Sql.js library
11-
// However, that function might be called multiple times, and on subsequent calls, we want it to return the same module that it's already loaded once before.
10+
// However, that function might be called multiple times, and on subsequent calls, we don't actually want it to instantiate a new instance of the Module
11+
// Instead, we want to return the previously loaded module
1212

13+
// TODO: Make this not declare a global if used in the browser
1314
var initSqlJsPromise = undefined;
1415

1516
var initSqlJs = function (moduleConfig) {
@@ -18,7 +19,7 @@ var initSqlJs = function (moduleConfig) {
1819
return initSqlJsPromise;
1920
}
2021
// If we're here, we've never called this function before
21-
initSqlJsPromise = new Promise((resolveModule) => {
22+
initSqlJsPromise = new Promise((resolveModule, reject) => {
2223

2324
// We are modularizing this manually because the current modularize setting in Emscripten has some issues:
2425
// https://github.com/kripken/emscripten/issues/5820
@@ -47,6 +48,24 @@ var initSqlJs = function (moduleConfig) {
4748
// When Emscripted calls postRun, this promise resolves with the built Module
4849
resolveModule(Module);
4950
});
51+
52+
// There is a section of code in the emcc-generated code below that looks like this:
53+
// (Note that this is lowercase `module`)
54+
// if (typeof module !== 'undefined') {
55+
// module['exports'] = Module;
56+
// }
57+
// When that runs, it's going to overwrite our own modularization export efforts in shell-post.js!
58+
// The only way to tell emcc not to emit it is to pass the MODULARIZE=1 or MODULARIZE_INSTANCE=1 flags,
59+
// but that carries with it additional unnecessary baggage/bugs we don't want either.
60+
// So, we have three options:
61+
// 1) We undefine `module`
62+
// 2) We remember what `module['exports']` was at the beginning of this function and we restore it later
63+
// 3) We write a script to remove those lines of code as part of the Make process.
64+
//
65+
// Since those are the only lines of code that care about module, we will undefine it. It's the most straightforward
66+
// of the options, and has the side effect of reducing emcc's efforts to modify the module if its output were to change in the future.
67+
// That's a nice side effect since we're handling the modularization efforts ourselves
68+
module = undefined;
5069

5170
// The emcc-generated code and shell-post.js code goes below,
5271
// meaning that all of it runs inside of this promise. If anything throws an exception, our promise will abort
@@ -7122,9 +7141,17 @@ run();
71227141
return initSqlJsPromise;
71237142
} // The end of our initSqlJs function
71247143

7125-
// This will allow the module to be used in ES6 or CommonJS
7126-
initSqlJs.default = initSqlJs;
7144+
// This bit below is copied almost exactly from what you get when you use the MODULARIZE=1 flag with emcc
7145+
// However, we don't want to use the emcc modularization. See shell-pre.js
71277146
if (typeof exports === 'object' && typeof module === 'object'){
71287147
module.exports = initSqlJs;
7148+
// This will allow the module to be used in ES6 or CommonJS
7149+
module.exports.default = initSqlJs;
71297150
}
7130-
7151+
else if (typeof define === 'function' && define['amd']) {
7152+
define([], function() { return initSqlJs; });
7153+
}
7154+
else if (typeof exports === 'object'){
7155+
exports["Module"] = initSqlJs;
7156+
}
7157+

0 commit comments

Comments
 (0)