|
1 | 1 | import { Generator, lookup } from "@jspm/generator";
|
2 | 2 | import assert from "assert";
|
3 | 3 |
|
4 |
| -// { |
5 |
| -// const generator = new Generator({ |
6 |
| -// inputMap: { |
7 |
| -// imports: { |
8 |
| -// react: "https://ga.jspm.io/npm:react@17.0.1/dev.index.js", |
9 |
| -// }, |
10 |
| -// scopes: { |
11 |
| -// "https://ga.jspm.io/": { |
12 |
| -// "object-assign": |
13 |
| -// "https://ga.jspm.io/npm:object-assign@4.1.0/index.js", |
14 |
| -// }, |
15 |
| -// }, |
16 |
| -// }, |
17 |
| -// mapUrl: import.meta.url, |
18 |
| -// defaultProvider: "jspm.io", |
19 |
| -// env: ["production", "browser"], |
20 |
| -// }); |
| 4 | +{ |
| 5 | + const generator = new Generator({ |
| 6 | + inputMap: { |
| 7 | + imports: { |
| 8 | + react: "https://ga.jspm.io/npm:react@17.0.1/dev.index.js", |
| 9 | + }, |
| 10 | + scopes: { |
| 11 | + "https://ga.jspm.io/": { |
| 12 | + "object-assign": |
| 13 | + "https://ga.jspm.io/npm:object-assign@4.1.0/index.js", |
| 14 | + }, |
| 15 | + }, |
| 16 | + }, |
| 17 | + mapUrl: import.meta.url, |
| 18 | + defaultProvider: "jspm.io", |
| 19 | + env: ["production", "browser"], |
| 20 | + }); |
21 | 21 |
|
22 |
| -// await generator.update("react"); |
23 |
| -// const json = generator.getMap(); |
| 22 | + await generator.update("react"); |
| 23 | + const json = generator.getMap(); |
24 | 24 |
|
25 |
| -// assert.strictEqual( |
26 |
| -// json.imports.react, |
27 |
| -// "https://ga.jspm.io/npm:react@17.0.2/index.js" |
28 |
| -// ); |
29 |
| -// assert.strictEqual( |
30 |
| -// json.scopes["https://ga.jspm.io/"]["object-assign"], |
31 |
| -// "https://ga.jspm.io/npm:object-assign@4.1.1/index.js" |
32 |
| -// ); |
33 |
| -// assert.strictEqual(Object.keys(json.imports).length, 1); |
34 |
| -// assert.strictEqual(Object.keys(json.scopes["https://ga.jspm.io/"]).length, 1); |
35 |
| -// } |
| 25 | + assert.strictEqual( |
| 26 | + json.imports.react, |
| 27 | + "https://ga.jspm.io/npm:react@17.0.2/index.js" |
| 28 | + ); |
| 29 | + assert.strictEqual( |
| 30 | + json.scopes["https://ga.jspm.io/"]["object-assign"], |
| 31 | + "https://ga.jspm.io/npm:object-assign@4.1.1/index.js" |
| 32 | + ); |
| 33 | + assert.strictEqual(Object.keys(json.imports).length, 1); |
| 34 | + assert.strictEqual(Object.keys(json.scopes["https://ga.jspm.io/"]).length, 1); |
| 35 | +} |
36 | 36 |
|
37 |
| -// { |
38 |
| -// const generator = new Generator({ |
39 |
| -// inputMap: { |
40 |
| -// imports: { |
41 |
| -// lit: "https://ga.jspm.io/npm:lit@2.2.4/index.js", |
42 |
| -// "lit/directive.js": "https://ga.jspm.io/npm:lit@2.2.4/directive.js", |
43 |
| -// }, |
44 |
| -// scopes: { |
45 |
| -// "https://ga.jspm.io/": { |
46 |
| -// "@lit/reactive-element": |
47 |
| -// "https://ga.jspm.io/npm:@lit/reactive-element@1.3.4/reactive-element.js", |
48 |
| -// "lit-element/lit-element.js": |
49 |
| -// "https://ga.jspm.io/npm:lit-element@3.2.2/lit-element.js", |
50 |
| -// "lit-html": "https://ga.jspm.io/npm:lit-html@2.2.7/lit-html.js", |
51 |
| -// "lit-html/directive.js": |
52 |
| -// "https://ga.jspm.io/npm:lit-html@2.2.7/directive.js", |
53 |
| -// }, |
54 |
| -// }, |
55 |
| -// }, |
56 |
| -// mapUrl: import.meta.url, |
57 |
| -// defaultProvider: "jspm.io", |
58 |
| -// env: ["production", "browser"], |
59 |
| -// }); |
| 37 | +{ |
| 38 | + const generator = new Generator({ |
| 39 | + inputMap: { |
| 40 | + imports: { |
| 41 | + lit: "https://ga.jspm.io/npm:lit@2.2.4/index.js", |
| 42 | + "lit/directive.js": "https://ga.jspm.io/npm:lit@2.2.4/directive.js", |
| 43 | + }, |
| 44 | + scopes: { |
| 45 | + "https://ga.jspm.io/": { |
| 46 | + "@lit/reactive-element": |
| 47 | + "https://ga.jspm.io/npm:@lit/reactive-element@1.3.4/reactive-element.js", |
| 48 | + "lit-element/lit-element.js": |
| 49 | + "https://ga.jspm.io/npm:lit-element@3.2.2/lit-element.js", |
| 50 | + "lit-html": "https://ga.jspm.io/npm:lit-html@2.2.7/lit-html.js", |
| 51 | + "lit-html/directive.js": |
| 52 | + "https://ga.jspm.io/npm:lit-html@2.2.7/directive.js", |
| 53 | + }, |
| 54 | + }, |
| 55 | + }, |
| 56 | + mapUrl: import.meta.url, |
| 57 | + defaultProvider: "jspm.io", |
| 58 | + env: ["production", "browser"], |
| 59 | + }); |
60 | 60 |
|
61 |
| -// await generator.update("lit"); |
62 |
| -// const json = generator.getMap(); |
63 |
| -// const expectedVersion = (await lookup("lit@2")).resolved.version; |
| 61 | + await generator.update("lit"); |
| 62 | + const json = generator.getMap(); |
| 63 | + const expectedVersion = (await lookup("lit@2")).resolved.version; |
64 | 64 |
|
65 |
| -// assert.strictEqual( |
66 |
| -// json.imports.lit, |
67 |
| -// `https://ga.jspm.io/npm:lit@${expectedVersion}/index.js` |
68 |
| -// ); |
69 |
| -// assert.strictEqual( |
70 |
| -// json.imports["lit/directive.js"], |
71 |
| -// `https://ga.jspm.io/npm:lit@${expectedVersion}/directive.js` |
72 |
| -// ); |
73 |
| -// } |
| 65 | + assert.strictEqual( |
| 66 | + json.imports.lit, |
| 67 | + `https://ga.jspm.io/npm:lit@${expectedVersion}/index.js` |
| 68 | + ); |
| 69 | + assert.strictEqual( |
| 70 | + json.imports["lit/directive.js"], |
| 71 | + `https://ga.jspm.io/npm:lit@${expectedVersion}/directive.js` |
| 72 | + ); |
| 73 | +} |
74 | 74 |
|
75 | 75 | {
|
76 | 76 | const generator = new Generator({ defaultProvider: 'jsdelivr' });
|
|
0 commit comments