hotwire-stimulus-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e59c0eb532f35c4984c79bec4ff94904a95d21c657bbc880d0129e4c61c9f283
4
+ data.tar.gz: b3c36d83906cd9ec6f8fb9c4d35ed3eead0edb3cfdbd58d3bb4e0e33038de6bb
5
+ SHA512:
6
+ metadata.gz: 6d0f022759a756b5621dbb39fd0cb0acccbe7737d9d31c1fafd0c2c45d65874527e49cfd88eb289473198b2d3b3a2b8ef523ba0718afbb94bae44184d5f01176
7
+ data.tar.gz: d83c15b2c72553d75bc9aa34fc670b48e721a1895674679a077a37ee073d19ad9f594e976572379e50a78ba2faddc78e41300033d2049c504514265a9975714b
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2020 Basecamp
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,66 @@
1
+ # Stimulus for Rails
2
+
3
+ [Stimulus](https://stimulus.hotwire.dev) is a JavaScript framework with modest ambitions. It doesn’t seek to take over your entire front-end—in fact, it’s not concerned with rendering HTML at all. Instead, it’s designed to augment your HTML with just enough behavior to make it shine. Stimulus pairs beautifully with Turbo to provide a complete solution for fast, compelling applications with a minimal amount of effort.
4
+
5
+ Stimulus for Rails makes it easy to use this modest framework with the asset pipeline and ES6/ESM in the browser. It uses the 7kb es-module-shim to provide [importmap](https://github.com/WICG/import-maps) support for all ES6-compatible browsers. This means you can develop and deploy without using any bundling or transpiling at all! Far less complexity, no waiting for compiling.
6
+
7
+ If you want to use Stimulus with a bundler, you should use [Webpacker](https://github.com/rails/webpacker) instead. This gem is purely intended for those who wish to use Stimulus with the asset pipeline using ESM in the browser.
8
+
9
+ ## Installation
10
+
11
+ 1. Add the `hotwire-stimulus-rails` gem to your Gemfile: `gem 'hotwire-stimulus-rails'`
12
+ 2. Run `./bin/bundle install`.
13
+ 3. Run `./bin/rails stimulus:install`
14
+
15
+ The last command will:
16
+
17
+ 1. Create an example controller in app/assets/javascripts/controllers/hello_controller.js
18
+ 2. Append the include tags to the `<head>` of your application.html.erb.
19
+ 3. Initialize your importmap.json in app/assets/javascripts/importmap.json.erb.
20
+ 4. Ensure JavaScript is included in your app/config/manifest.js file for compilcation.
21
+
22
+
23
+ ## Usage
24
+
25
+ With the Stimulus include tags added, you'll automatically have activated Stimulus through the controller autoloader. You can now easily add new Stimulus controllers that'll be loaded via ESM dynamic imports.
26
+
27
+ For example, a more advanced hello_controller could look like this:
28
+
29
+ ```javascript
30
+ // app/assets/javascripts/controllers/hello_controller.js
31
+ import { Controller } from "stimulus"
32
+
33
+ export default class extends Controller {
34
+ static targets = [ "name", "output" ]
35
+
36
+ greet() {
37
+ this.outputTarget.textContent = `Hello, ${this.nameTarget.value}!`
38
+ }
39
+ }
40
+ ```
41
+
42
+ And it'll be activated and registered automatically when encountering the data-controller attribute in your DOM:
43
+
44
+ ```html
45
+ <div data-controller="hello">
46
+ <input data-target="hello.name" type="text">
47
+
48
+ <button data-action="click->hello#greet">
49
+ Greet
50
+ </button>
51
+
52
+ <span data-target="hello.output">
53
+ </span>
54
+ </div>
55
+ ```
56
+
57
+ That's it!
58
+
59
+ You can add additional libraries needed by your controllers in `app/assets/javascripts/libraries` using the `library@1.0.0.js` naming convention. These libraries will be added to the dynamically generated [importmap](https://github.com/WICG/import-maps) (a shim is included with the `stimulus_include_tags`), so you can reference `cookies@0.5.6.js` as `import Cookie from "cookies"`.
60
+
61
+ The libraries must be made for ESM. See https://skypack.dev where you can either directly reference libraries or download them and use them with the ESM conversion.
62
+
63
+
64
+ ## License
65
+
66
+ Stimulus for Rails is released under the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,13 @@
1
+ require "bundler/setup"
2
+
3
+ require "bundler/gem_tasks"
4
+
5
+ require "rake/testtask"
6
+
7
+ Rake::TestTask.new(:test) do |t|
8
+ t.libs << 'test'
9
+ t.pattern = 'test/**/*_test.rb'
10
+ t.verbose = false
11
+ end
12
+
13
+ task default: :test
@@ -0,0 +1 @@
1
+ //= require ./es-module-shims@0.7.1.js
@@ -0,0 +1,475 @@
1
+ /* ES Module Shims 0.5.0 */
2
+ (function () {
3
+ 'use strict';
4
+
5
+ const resolvedPromise = Promise.resolve();
6
+
7
+ let baseUrl;
8
+
9
+ function createBlob (source) {
10
+ return URL.createObjectURL(new Blob([source], { type: 'application/javascript' }));
11
+ }
12
+
13
+ const hasDocument = typeof document !== 'undefined';
14
+
15
+ // support browsers without dynamic import support (eg Firefox 6x)
16
+ let dynamicImport;
17
+ try {
18
+ dynamicImport = (0, eval)('u=>import(u)');
19
+ }
20
+ catch (e) {
21
+ if (hasDocument) {
22
+ self.addEventListener('error', e => importShim.e = e.error);
23
+ dynamicImport = blobUrl => {
24
+ const topLevelBlobUrl = createBlob(
25
+ `import*as m from'${blobUrl}';self.importShim.l=m;self.importShim.e=null`
26
+ );
27
+ const s = document.createElement('script');
28
+ s.type = 'module';
29
+ s.src = topLevelBlobUrl;
30
+ document.head.appendChild(s);
31
+ return new Promise((resolve, reject) => {
32
+ s.addEventListener('load', () => {
33
+ document.head.removeChild(s);
34
+ importShim.e ? reject(importShim.e) : resolve(importShim.l, baseUrl);
35
+ });
36
+ });
37
+ };
38
+ }
39
+ }
40
+
41
+ if (hasDocument) {
42
+ const baseEl = document.querySelector('base[href]');
43
+ if (baseEl)
44
+ baseUrl = baseEl.href;
45
+ }
46
+
47
+ if (!baseUrl && typeof location !== 'undefined') {
48
+ baseUrl = location.href.split('#')[0].split('?')[0];
49
+ const lastSepIndex = baseUrl.lastIndexOf('/');
50
+ if (lastSepIndex !== -1)
51
+ baseUrl = baseUrl.slice(0, lastSepIndex + 1);
52
+ }
53
+
54
+ let esModuleShimsSrc;
55
+ if (hasDocument) {
56
+ esModuleShimsSrc = document.currentScript && document.currentScript.src;
57
+ }
58
+
59
+ const backslashRegEx = /\\/g;
60
+ function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
61
+ // strip off any trailing query params or hashes
62
+ parentUrl = parentUrl && parentUrl.split('#')[0].split('?')[0];
63
+ if (relUrl.indexOf('\\') !== -1)
64
+ relUrl = relUrl.replace(backslashRegEx, '/');
65
+ // protocol-relative
66
+ if (relUrl[0] === '/' && relUrl[1] === '/') {
67
+ return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;
68
+ }
69
+ // relative-url
70
+ else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
71
+ relUrl.length === 1 && (relUrl += '/')) ||
72
+ relUrl[0] === '/') {
73
+ const parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
74
+ // Disabled, but these cases will give inconsistent results for deep backtracking
75
+ //if (parentUrl[parentProtocol.length] !== '/')
76
+ // throw new Error('Cannot resolve');
77
+ // read pathname from parent URL
78
+ // pathname taken to be part after leading "/"
79
+ let pathname;
80
+ if (parentUrl[parentProtocol.length + 1] === '/') {
81
+ // resolving to a :// so we need to read out the auth and host
82
+ if (parentProtocol !== 'file:') {
83
+ pathname = parentUrl.slice(parentProtocol.length + 2);
84
+ pathname = pathname.slice(pathname.indexOf('/') + 1);
85
+ }
86
+ else {
87
+ pathname = parentUrl.slice(8);
88
+ }
89
+ }
90
+ else {
91
+ // resolving to :/ so pathname is the /... part
92
+ pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));
93
+ }
94
+
95
+ if (relUrl[0] === '/')
96
+ return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;
97
+
98
+ // join together and split for removal of .. and . segments
99
+ // looping the string instead of anything fancy for perf reasons
100
+ // '../../../../../z' resolved to 'x/y' is just 'z'
101
+ const segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;
102
+
103
+ const output = [];
104
+ let segmentIndex = -1;
105
+ for (let i = 0; i < segmented.length; i++) {
106
+ // busy reading a segment - only terminate on '/'
107
+ if (segmentIndex !== -1) {
108
+ if (segmented[i] === '/') {
109
+ output.push(segmented.slice(segmentIndex, i + 1));
110
+ segmentIndex = -1;
111
+ }
112
+ }
113
+
114
+ // new segment - check if it is relative
115
+ else if (segmented[i] === '.') {
116
+ // ../ segment
117
+ if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
118
+ output.pop();
119
+ i += 2;
120
+ }
121
+ // ./ segment
122
+ else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
123
+ i += 1;
124
+ }
125
+ else {
126
+ // the start of a new segment as below
127
+ segmentIndex = i;
128
+ }
129
+ }
130
+ // it is the start of a new segment
131
+ else {
132
+ segmentIndex = i;
133
+ }
134
+ }
135
+ // finish reading out the last segment
136
+ if (segmentIndex !== -1)
137
+ output.push(segmented.slice(segmentIndex));
138
+ return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');
139
+ }
140
+ }
141
+
142
+ /*
143
+ * Import maps implementation
144
+ *
145
+ * To make lookups fast we pre-resolve the entire import map
146
+ * and then match based on backtracked hash lookups
147
+ *
148
+ */
149
+ function resolveUrl (relUrl, parentUrl) {
150
+ return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (relUrl.indexOf(':') !== -1 ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
151
+ }
152
+
153
+ function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap) {
154
+ for (let p in packages) {
155
+ const resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
156
+ let target = packages[p];
157
+ if (typeof target !== 'string')
158
+ continue;
159
+ const mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(target, baseUrl) || target, baseUrl);
160
+ if (mapped) {
161
+ outPackages[resolvedLhs] = mapped;
162
+ continue;
163
+ }
164
+ targetWarning(p, packages[p], 'bare specifier did not resolve');
165
+ }
166
+ }
167
+
168
+ function resolveAndComposeImportMap (json, baseUrl, parentMap) {
169
+ const outMap = { imports: Object.assign({}, parentMap.imports), scopes: Object.assign({}, parentMap.scopes), depcache: Object.assign({}, parentMap.depcache) };
170
+
171
+ if (json.imports)
172
+ resolveAndComposePackages(json.imports, outMap.imports, baseUrl, parentMap,);
173
+
174
+ if (json.scopes)
175
+ for (let s in json.scopes) {
176
+ const resolvedScope = resolveUrl(s, baseUrl);
177
+ resolveAndComposePackages(json.scopes[s], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, parentMap);
178
+ }
179
+
180
+ if (json.depcache)
181
+ for (let d in json.depcache) {
182
+ const resolvedDepcache = resolveUrl(d, baseUrl);
183
+ outMap.depcache[resolvedDepcache] = json.depcache[d];
184
+ }
185
+
186
+ return outMap;
187
+ }
188
+
189
+ function getMatch (path, matchObj) {
190
+ if (matchObj[path])
191
+ return path;
192
+ let sepIndex = path.length;
193
+ do {
194
+ const segment = path.slice(0, sepIndex + 1);
195
+ if (segment in matchObj)
196
+ return segment;
197
+ } while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)
198
+ }
199
+
200
+ function applyPackages (id, packages) {
201
+ const pkgName = getMatch(id, packages);
202
+ if (pkgName) {
203
+ const pkg = packages[pkgName];
204
+ if (pkg === null) return;
205
+ if (id.length > pkgName.length && pkg[pkg.length - 1] !== '/')
206
+ targetWarning(pkgName, pkg, "should have a trailing '/'");
207
+ else
208
+ return pkg + id.slice(pkgName.length);
209
+ }
210
+ }
211
+
212
+ function targetWarning (match, target, msg) {
213
+ console.warn("Package target " + msg + ", resolving target '" + target + "' for " + match);
214
+ }
215
+
216
+ function resolveImportMap (importMap, resolvedOrPlain, parentUrl) {
217
+ let scopeUrl = parentUrl && getMatch(parentUrl, importMap.scopes);
218
+ while (scopeUrl) {
219
+ const packageResolution = applyPackages(resolvedOrPlain, importMap.scopes[scopeUrl]);
220
+ if (packageResolution)
221
+ return packageResolution;
222
+ scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), importMap.scopes);
223
+ }
224
+ return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain;
225
+ }
226
+
227
+ /* es-module-lexer 0.3.26 */
228
+ const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse(E,g="@"){if(!B)return init.then(()=>parse(E));const I=E.length+1,D=(B.__heap_base.value||B.__heap_base)+4*I-B.memory.buffer.byteLength;D>0&&B.memory.grow(Math.ceil(D/65536));const w=B.sa(I-1);if((A?C:Q)(E,new Uint16Array(B.memory.buffer,w,I)),!B.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,B.e()).split("\n").length}:${B.e()-E.lastIndexOf("\n",B.e()-1)}`),{idx:B.e()});const L=[],k=[];for(;B.ri();)L.push({s:B.is(),e:B.ie(),ss:B.ss(),se:B.se(),d:B.id()});for(;B.re();)k.push(E.slice(B.es(),B.ee()));return [L,k,!!B.f()]}function Q(A,Q){const C=A.length;let B=0;for(;B<C;){const C=A.charCodeAt(B);Q[B++]=(255&C)<<8|C>>>8;}}function C(A,Q){const C=A.length;let B=0;for(;B<C;)Q[B]=A.charCodeAt(B++);}let B;const init=WebAssembly.compile((E="AGFzbQEAAAABWAxgAX8Bf2AEf39/fwBgAn9/AGAAAX9gAABgBn9/f39/fwF/YAR/f39/AX9gA39/fwF/YAd/f39/f39/AX9gBX9/f39/AX9gAn9/AX9gCH9/f39/f39/AX8DLy4AAQIDAwMDAwMDAwMDAwAEBAAFBAQAAAAABAQEBAQABQYHCAkKCwMCAAAKAwgLBAUBcAEBAQUDAQABBg8CfwFB8PAAC38AQfDwAAsHWg8GbWVtb3J5AgACc2EAAAFlAAMCaXMABAJpZQAFAnNzAAYCc2UABwJpZAAIAmVzAAkCZWUACgJyaQALAnJlAAwBZgANBXBhcnNlAA4LX19oZWFwX2Jhc2UDAQqjMy5oAQF/QQAgADYCtAhBACgCkAgiASAAQQF0aiIAQQA7AQBBACAAQQJqIgA2ArgIQQAgADYCvAhBAEEANgKUCEEAQQA2AqQIQQBBADYCnAhBAEEANgKYCEEAQQA2AqwIQQBBADYCoAggAQudAQECf0EAKAKkCCIEQRRqQZQIIAQbQQAoArwIIgU2AgBBACAFNgKkCEEAIAQ2AqgIQQAgBUEYajYCvAggBSAANgIIAkACQEEAKAKICCADRw0AIAUgAjYCDAwBCwJAQQAoAoQIIANHDQAgBSACQQJqNgIMDAELIAVBACgCkAg2AgwLIAVBADYCFCAFIAM2AhAgBSACNgIEIAUgATYCAAtIAQF/QQAoAqwIIgJBCGpBmAggAhtBACgCvAgiAjYCAEEAIAI2AqwIQQAgAkEMajYCvAggAkEANgIIIAIgATYCBCACIAA2AgALCABBACgCwAgLFQBBACgCnAgoAgBBACgCkAhrQQF1CxUAQQAoApwIKAIEQQAoApAIa0EBdQsVAEEAKAKcCCgCCEEAKAKQCGtBAXULFQBBACgCnAgoAgxBACgCkAhrQQF1CzsBAX8CQEEAKAKcCCgCECIAQQAoAoQIRw0AQX8PCwJAIABBACgCiAhHDQBBfg8LIABBACgCkAhr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AkACQCAAIAFPDQAgAi8BACIDQaR/aiIEQQFNDQEgAiEAIANBdmoiA0EDSw0CIAIhACADDgQAAgIAAAtBACACNgLgCBAdQQAPCwJAAkAgBA4CAQABC0EAIAI2AuAIQd0ADwsgAEEEaiEADAALC0kBAX9BACEHAkAgAC8BCiAGRw0AIAAvAQggBUcNACAALwEGIARHDQAgAC8BBCADRw0AIAAvAQIgAkcNACAALwEAIAFGIQcLIAcLUwEBf0EAIQgCQCAALwEMIAdHDQAgAC8BCiAGRw0AIAAvAQggBUcNACAALwEGIARHDQAgAC8BBCADRw0AIAAvAQIgAkcNACAALwEAIAFGIQgLIAgLCx8CAEGACAsCAAAAQYQICxABAAAAAgAAAAAEAABwOAAA","function"==typeof atob?Uint8Array.from(atob(E),A=>A.charCodeAt(0)):Buffer.from(E,"base64"))).then(WebAssembly.instantiate).then(({exports:A})=>{B=A;});var E;
229
+
230
+ let id = 0;
231
+ const registry = {};
232
+
233
+ async function loadAll (load, seen) {
234
+ if (load.b || seen[load.u])
235
+ return;
236
+ seen[load.u] = 1;
237
+ await load.L;
238
+ return Promise.all(load.d.map(dep => loadAll(dep, seen)));
239
+ }
240
+
241
+ let waitingForImportMapsInterval;
242
+ let firstTopLevelProcess = true;
243
+ async function topLevelLoad (url, source) {
244
+ if (waitingForImportMapsInterval > 0) {
245
+ clearTimeout(waitingForImportMapsInterval);
246
+ waitingForImportMapsInterval = 0;
247
+ }
248
+ if (firstTopLevelProcess) {
249
+ firstTopLevelProcess = false;
250
+ processScripts();
251
+ }
252
+ await importMapPromise;
253
+ await init;
254
+ const load = getOrCreateLoad(url, source);
255
+ const seen = {};
256
+ await loadAll(load, seen);
257
+ lastLoad = undefined;
258
+ resolveDeps(load, seen);
259
+ const module = await dynamicImport(load.b);
260
+ // if the top-level load is a shell, run its update function
261
+ if (load.s)
262
+ (await dynamicImport(load.s)).u$_(module);
263
+ return module;
264
+ }
265
+
266
+ async function importShim$1 (id, parentUrl) {
267
+ return topLevelLoad(resolve(id, parentUrl || baseUrl));
268
+ }
269
+
270
+ self.importShim = importShim$1;
271
+
272
+ const meta = {};
273
+
274
+ const edge = navigator.userAgent.match(/Edge\/\d\d\.\d+$/);
275
+
276
+ async function importMetaResolve (id, parentUrl = this.url) {
277
+ await importMapPromise;
278
+ return resolve(id, `${parentUrl}`);
279
+ }
280
+
281
+ Object.defineProperties(importShim$1, {
282
+ m: { value: meta },
283
+ l: { value: undefined, writable: true },
284
+ e: { value: undefined, writable: true }
285
+ });
286
+ importShim$1.fetch = url => fetch(url);
287
+ importShim$1.skip = /^https?:\/\/(cdn\.pika\.dev|dev\.jspm\.io|jspm\.dev)\//;
288
+ importShim$1.load = processScripts;
289
+ importShim$1.onerror = (e) => {
290
+ throw e;
291
+ };
292
+
293
+ let lastLoad;
294
+ function resolveDeps (load, seen) {
295
+ if (load.b || !seen[load.u])
296
+ return;
297
+ seen[load.u] = 0;
298
+
299
+ for (const dep of load.d)
300
+ resolveDeps(dep, seen);
301
+
302
+ // "execution"
303
+ const source = load.S;
304
+ // edge doesnt execute sibling in order, so we fix this up by ensuring all previous executions are explicit dependencies
305
+ let resolvedSource = edge && lastLoad ? `import '${lastLoad}';` : '';
306
+
307
+ const [imports] = load.a;
308
+
309
+ if (!imports.length) {
310
+ resolvedSource += source;
311
+ }
312
+ else {
313
+ // once all deps have loaded we can inline the dependency resolution blobs
314
+ // and define this blob
315
+ let lastIndex = 0, depIndex = 0;
316
+ for (const { s: start, e: end, d: dynamicImportIndex } of imports) {
317
+ // dependency source replacements
318
+ if (dynamicImportIndex === -1) {
319
+ const depLoad = load.d[depIndex++];
320
+ let blobUrl = depLoad.b;
321
+ if (!blobUrl) {
322
+ // circular shell creation
323
+ if (!(blobUrl = depLoad.s)) {
324
+ blobUrl = depLoad.s = createBlob(`export function u$_(m){${
325
+ depLoad.a[1].map(
326
+ name => name === 'default' ? `$_default=m.default` : `${name}=m.${name}`
327
+ ).join(',')
328
+ }}${
329
+ depLoad.a[1].map(name =>
330
+ name === 'default' ? `let $_default;export{$_default as default}` : `export let ${name}`
331
+ ).join(';')
332
+ }\n//# sourceURL=${depLoad.r}?cycle`);
333
+ }
334
+ }
335
+ // circular shell execution
336
+ else if (depLoad.s) {
337
+ resolvedSource += source.slice(lastIndex, start - 1) + '/*' + source.slice(start - 1, end + 1) + '*/' + source.slice(start - 1, start) + blobUrl + source[end] + `;import*as m$_${depIndex} from'${depLoad.b}';import{u$_ as u$_${depIndex}}from'${depLoad.s}';u$_${depIndex}(m$_${depIndex})`;
338
+ lastIndex = end + 1;
339
+ depLoad.s = undefined;
340
+ continue;
341
+ }
342
+ resolvedSource += source.slice(lastIndex, start - 1) + '/*' + source.slice(start - 1, end + 1) + '*/' + source.slice(start - 1, start) + blobUrl;
343
+ lastIndex = end;
344
+ }
345
+ // import.meta
346
+ else if (dynamicImportIndex === -2) {
347
+ meta[load.r] = { url: load.r, resolve: importMetaResolve };
348
+ resolvedSource += source.slice(lastIndex, start) + 'importShim.m[' + JSON.stringify(load.r) + ']';
349
+ lastIndex = end;
350
+ }
351
+ // dynamic import
352
+ else {
353
+ resolvedSource += source.slice(lastIndex, dynamicImportIndex + 6) + 'Shim(' + source.slice(start, end) + ', ' + JSON.stringify(load.r);
354
+ lastIndex = end;
355
+ }
356
+ }
357
+
358
+ resolvedSource += source.slice(lastIndex);
359
+ }
360
+
361
+ let sourceMappingResolved = '';
362
+ const sourceMappingIndex = resolvedSource.lastIndexOf('//# sourceMappingURL=');
363
+ if (sourceMappingIndex > -1) {
364
+ const sourceMappingEnd = resolvedSource.indexOf('\n',sourceMappingIndex);
365
+ const sourceMapping = resolvedSource.slice(sourceMappingIndex, sourceMappingEnd > -1 ? sourceMappingEnd : undefined);
366
+ sourceMappingResolved = `\n//# sourceMappingURL=` + resolveUrl(sourceMapping.slice(21), load.r);
367
+ }
368
+ load.b = lastLoad = createBlob(resolvedSource + sourceMappingResolved + '\n//# sourceURL=' + load.r);
369
+ load.S = undefined;
370
+ }
371
+
372
+ function getOrCreateLoad (url, source) {
373
+ let load = registry[url];
374
+ if (load)
375
+ return load;
376
+
377
+ load = registry[url] = {
378
+ // url
379
+ u: url,
380
+ // response url
381
+ r: undefined,
382
+ // fetchPromise
383
+ f: undefined,
384
+ // source
385
+ S: undefined,
386
+ // linkPromise
387
+ L: undefined,
388
+ // analysis
389
+ a: undefined,
390
+ // deps
391
+ d: undefined,
392
+ // blobUrl
393
+ b: undefined,
394
+ // shellUrl
395
+ s: undefined,
396
+ };
397
+
398
+ const depcache = importMap.depcache[url];
399
+ if (depcache)
400
+ depcache.forEach(depUrl => getOrCreateLoad(resolve(depUrl, url)));
401
+
402
+ load.f = (async () => {
403
+ if (!source) {
404
+ const res = await importShim$1.fetch(url);
405
+ if (!res.ok)
406
+ throw new Error(`${res.status} ${res.statusText} ${res.url}`);
407
+ load.r = res.url;
408
+ const contentType = res.headers.get('content-type');
409
+ if (contentType.match(/^(text|application)\/(x-)?javascript(;|$)/))
410
+ source = await res.text();
411
+ else
412
+ throw new Error(`Unknown Content-Type "${contentType}"`);
413
+ }
414
+ try {
415
+ load.a = parse(source, load.u);
416
+ }
417
+ catch (e) {
418
+ console.warn(e);
419
+ load.a = [[], []];
420
+ }
421
+ load.S = source;
422
+ return load.a[0].filter(d => d.d === -1).map(d => source.slice(d.s, d.e));
423
+ })();
424
+
425
+ load.L = load.f.then(async deps => {
426
+ load.d = await Promise.all(deps.map(async depId => {
427
+ const resolved = resolve(depId, load.r || load.u);
428
+ if (importShim$1.skip.test(resolved))
429
+ return { b: resolved };
430
+ const depLoad = getOrCreateLoad(resolved);
431
+ await depLoad.f;
432
+ return depLoad;
433
+ }));
434
+ });
435
+
436
+ return load;
437
+ }
438
+
439
+ let importMap = { imports: {}, scopes: {}, depcache: {} };
440
+ let importMapPromise = resolvedPromise;
441
+
442
+ if (hasDocument) {
443
+ processScripts();
444
+ waitingForImportMapsInterval = setInterval(processScripts, 20);
445
+ }
446
+
447
+ async function processScripts () {
448
+ if (waitingForImportMapsInterval > 0 && document.readyState !== 'loading') {
449
+ clearTimeout(waitingForImportMapsInterval);
450
+ waitingForImportMapsInterval = 0;
451
+ }
452
+ for (const script of document.querySelectorAll('script[type="module-shim"],script[type="importmap-shim"]')) {
453
+ if (script.ep) // ep marker = script processed
454
+ return;
455
+ if (script.type === 'module-shim') {
456
+ await topLevelLoad(script.src || `${baseUrl}?${id++}`, !script.src && script.innerHTML).catch(e => importShim$1.onerror(e));
457
+ }
458
+ else {
459
+ importMapPromise = importMapPromise.then(async () =>
460
+ importMap = resolveAndComposeImportMap(script.src ? await (await fetch(script.src)).json() : JSON.parse(script.innerHTML), script.src || baseUrl, importMap)
461
+ );
462
+ }
463
+ script.ep = true;
464
+ }
465
+ }
466
+
467
+ function resolve (id, parentUrl) {
468
+ return resolveImportMap(importMap, resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl) || throwUnresolved(id, parentUrl);
469
+ }
470
+
471
+ function throwUnresolved (id, parentUrl) {
472
+ throw Error("Unable to resolve specifier '" + id + (parentUrl ? "' from " + parentUrl : "'"));
473
+ }
474
+
475
+ }());