Skip to content

Instantly share code, notes, and snippets.

@AriPerkkio
Created August 31, 2022 17:18
Show Gist options
  • Save AriPerkkio/8399007031cb747b2811c07358b8daa2 to your computer and use it in GitHub Desktop.
Save AriPerkkio/8399007031cb747b2811c07358b8daa2 to your computer and use it in GitHub Desktop.
Svelte transpiled and instrumented
const fs = require("fs");
const svelte = require("svelte/compiler");
const { js: transpiled } = svelte.compile(
`<script>
export let users;
</script>
<ul>
{#each users as user}
<li>{user}</li>
{/each}
</ul>`,
{
filename: "svelte.repro",
outputFilename: "svelte.repro",
}
);
fs.writeFileSync("./transpiled.js", transpiled.code, "utf-8");
fs.writeFileSync(
"./transpiled.js.map",
JSON.stringify(transpiled.map, null, 2),
"utf-8"
);
const { createInstrumenter } = require("istanbul-lib-instrument");
const instrumenter = createInstrumenter({
esModules: true,
compact: false,
produceSourceMap: true,
autoWrap: false,
});
const instrumented = {
code: instrumenter.instrumentSync(
transpiled.code,
"repro.svelte",
transpiled.map
),
map: instrumenter.lastSourceMap(),
};
fs.writeFileSync("./instrumented.js", instrumented.code, "utf-8");
fs.writeFileSync(
"./instrumented.js.map",
JSON.stringify(instrumented.map, null, 2),
"utf-8"
);
const libCoverage = require("istanbul-lib-coverage");
const emptyCoverage = libCoverage.createCoverageMap({});
const coverage = instrumenter.lastFileCoverage();
fs.writeFileSync("./coverage.json", JSON.stringify(coverage, null, 2), "utf-8");
emptyCoverage.merge({ data: coverage });
const libSourceMaps = require("istanbul-lib-source-maps");
const libReport = require("istanbul-lib-report");
const reports = require("istanbul-reports");
const sourceMapStore = libSourceMaps.createSourceMapStore();
sourceMapStore.transformCoverage(emptyCoverage).then((coverageMap) => {
const context = libReport.createContext({
coverageMap,
sourceFinder: sourceMapStore.sourceFinder,
});
reports.create("html").execute(context);
});
const { SourceMapConsumer } = require("source-map");
(async function run() {
const consumer = await new SourceMapConsumer(transpiled.map);
const mappings = [];
consumer.eachMapping((m) => mappings.push(m));
mappings.sort((a, b) => {
const lineDiff = a.originalLine - b.originalLine;
if (lineDiff !== 0) return lineDiff;
return a.originalColumn - b.originalColumn;
});
fs.writeFileSync(
"./mappings.json",
JSON.stringify(mappings, null, 2),
"utf-8"
);
})();
function cov_208gup579f() {
var path = "repro.svelte";
var hash = "bde7a64d9476cfa52d52cd260594f012b38ab5f6";
var global = new Function("return this")();
var gcv = "__coverage__";
var coverageData = {
path: "repro.svelte",
statementMap: {
"0": {
start: {
line: 17,
column: 19
},
end: {
line: 17,
column: 30
}
},
"1": {
start: {
line: 18,
column: 1
},
end: {
line: 18,
column: 24
}
},
"2": {
start: {
line: 19,
column: 1
},
end: {
line: 19,
column: 18
}
},
"3": {
start: {
line: 25,
column: 24
},
end: {
line: 25,
column: 35
}
},
"4": {
start: {
line: 28,
column: 1
},
end: {
line: 43,
column: 3
}
},
"5": {
start: {
line: 30,
column: 3
},
end: {
line: 30,
column: 22
}
},
"6": {
start: {
line: 31,
column: 3
},
end: {
line: 31,
column: 21
}
},
"7": {
start: {
line: 34,
column: 3
},
end: {
line: 34,
column: 30
}
},
"8": {
start: {
line: 35,
column: 3
},
end: {
line: 35,
column: 17
}
},
"9": {
start: {
line: 38,
column: 3
},
end: {
line: 38,
column: 97
}
},
"10": {
start: {
line: 38,
column: 76
},
end: {
line: 38,
column: 97
}
},
"11": {
start: {
line: 41,
column: 3
},
end: {
line: 41,
column: 29
}
},
"12": {
start: {
line: 41,
column: 18
},
end: {
line: 41,
column: 29
}
},
"13": {
start: {
line: 48,
column: 28
},
end: {
line: 48,
column: 34
}
},
"14": {
start: {
line: 49,
column: 19
},
end: {
line: 49,
column: 21
}
},
"15": {
start: {
line: 51,
column: 1
},
end: {
line: 53,
column: 2
}
},
"16": {
start: {
line: 51,
column: 14
},
end: {
line: 51,
column: 15
}
},
"17": {
start: {
line: 52,
column: 2
},
end: {
line: 52,
column: 75
}
},
"18": {
start: {
line: 55,
column: 1
},
end: {
line: 100,
column: 3
}
},
"19": {
start: {
line: 57,
column: 3
},
end: {
line: 57,
column: 22
}
},
"20": {
start: {
line: 59,
column: 3
},
end: {
line: 61,
column: 4
}
},
"21": {
start: {
line: 59,
column: 16
},
end: {
line: 59,
column: 17
}
},
"22": {
start: {
line: 60,
column: 4
},
end: {
line: 60,
column: 23
}
},
"23": {
start: {
line: 64,
column: 3
},
end: {
line: 64,
column: 30
}
},
"24": {
start: {
line: 66,
column: 3
},
end: {
line: 68,
column: 4
}
},
"25": {
start: {
line: 66,
column: 16
},
end: {
line: 66,
column: 17
}
},
"26": {
start: {
line: 67,
column: 4
},
end: {
line: 67,
column: 31
}
},
"27": {
start: {
line: 71,
column: 3
},
end: {
line: 92,
column: 4
}
},
"28": {
start: {
line: 72,
column: 4
},
end: {
line: 72,
column: 34
}
},
"29": {
start: {
line: 75,
column: 4
},
end: {
line: 85,
column: 5
}
},
"30": {
start: {
line: 76,
column: 23
},
end: {
line: 76,
column: 59
}
},
"31": {
start: {
line: 78,
column: 5
},
end: {
line: 84,
column: 6
}
},
"32": {
start: {
line: 79,
column: 6
},
end: {
line: 79,
column: 41
}
},
"33": {
start: {
line: 81,
column: 6
},
end: {
line: 81,
column: 52
}
},
"34": {
start: {
line: 82,
column: 6
},
end: {
line: 82,
column: 25
}
},
"35": {
start: {
line: 83,
column: 6
},
end: {
line: 83,
column: 33
}
},
"36": {
start: {
line: 87,
column: 4
},
end: {
line: 89,
column: 5
}
},
"37": {
start: {
line: 88,
column: 5
},
end: {
line: 88,
column: 25
}
},
"38": {
start: {
line: 91,
column: 4
},
end: {
line: 91,
column: 43
}
},
"39": {
start: {
line: 97,
column: 3
},
end: {
line: 97,
column: 29
}
},
"40": {
start: {
line: 97,
column: 18
},
end: {
line: 97,
column: 29
}
},
"41": {
start: {
line: 98,
column: 3
},
end: {
line: 98,
column: 40
}
},
"42": {
start: {
line: 104,
column: 17
},
end: {
line: 104,
column: 24
}
},
"43": {
start: {
line: 106,
column: 1
},
end: {
line: 108,
column: 3
}
},
"44": {
start: {
line: 107,
column: 2
},
end: {
line: 107,
column: 65
}
},
"45": {
start: {
line: 107,
column: 26
},
end: {
line: 107,
column: 65
}
},
"46": {
start: {
line: 110,
column: 1
},
end: {
line: 110,
column: 16
}
},
"47": {
start: {
line: 115,
column: 2
},
end: {
line: 115,
column: 10
}
},
"48": {
start: {
line: 116,
column: 2
},
end: {
line: 116,
column: 79
}
}
},
fnMap: {
"0": {
name: "get_each_context",
decl: {
start: {
line: 16,
column: 9
},
end: {
line: 16,
column: 25
}
},
loc: {
start: {
line: 16,
column: 40
},
end: {
line: 20,
column: 1
}
},
line: 16
},
"1": {
name: "create_each_block",
decl: {
start: {
line: 23,
column: 9
},
end: {
line: 23,
column: 26
}
},
loc: {
start: {
line: 23,
column: 32
},
end: {
line: 44,
column: 1
}
},
line: 23
},
"2": {
name: "(anonymous_2)",
decl: {
start: {
line: 29,
column: 2
},
end: {
line: 29,
column: 3
}
},
loc: {
start: {
line: 29,
column: 6
},
end: {
line: 32,
column: 3
}
},
line: 29
},
"3": {
name: "(anonymous_3)",
decl: {
start: {
line: 33,
column: 2
},
end: {
line: 33,
column: 3
}
},
loc: {
start: {
line: 33,
column: 20
},
end: {
line: 36,
column: 3
}
},
line: 33
},
"4": {
name: "(anonymous_4)",
decl: {
start: {
line: 37,
column: 2
},
end: {
line: 37,
column: 3
}
},
loc: {
start: {
line: 37,
column: 16
},
end: {
line: 39,
column: 3
}
},
line: 37
},
"5": {
name: "(anonymous_5)",
decl: {
start: {
line: 40,
column: 2
},
end: {
line: 40,
column: 3
}
},
loc: {
start: {
line: 40,
column: 15
},
end: {
line: 42,
column: 3
}
},
line: 40
},
"6": {
name: "create_fragment",
decl: {
start: {
line: 46,
column: 9
},
end: {
line: 46,
column: 24
}
},
loc: {
start: {
line: 46,
column: 30
},
end: {
line: 101,
column: 1
}
},
line: 46
},
"7": {
name: "(anonymous_7)",
decl: {
start: {
line: 56,
column: 2
},
end: {
line: 56,
column: 3
}
},
loc: {
start: {
line: 56,
column: 6
},
end: {
line: 62,
column: 3
}
},
line: 56
},
"8": {
name: "(anonymous_8)",
decl: {
start: {
line: 63,
column: 2
},
end: {
line: 63,
column: 3
}
},
loc: {
start: {
line: 63,
column: 20
},
end: {
line: 69,
column: 3
}
},
line: 63
},
"9": {
name: "(anonymous_9)",
decl: {
start: {
line: 70,
column: 2
},
end: {
line: 70,
column: 3
}
},
loc: {
start: {
line: 70,
column: 18
},
end: {
line: 93,
column: 3
}
},
line: 70
},
"10": {
name: "(anonymous_10)",
decl: {
start: {
line: 96,
column: 2
},
end: {
line: 96,
column: 3
}
},
loc: {
start: {
line: 96,
column: 15
},
end: {
line: 99,
column: 3
}
},
line: 96
},
"11": {
name: "instance",
decl: {
start: {
line: 103,
column: 9
},
end: {
line: 103,
column: 17
}
},
loc: {
start: {
line: 103,
column: 49
},
end: {
line: 111,
column: 1
}
},
line: 103
},
"12": {
name: "(anonymous_12)",
decl: {
start: {
line: 106,
column: 16
},
end: {
line: 106,
column: 17
}
},
loc: {
start: {
line: 106,
column: 27
},
end: {
line: 108,
column: 2
}
},
line: 106
},
"13": {
name: "(anonymous_13)",
decl: {
start: {
line: 114,
column: 1
},
end: {
line: 114,
column: 2
}
},
loc: {
start: {
line: 114,
column: 22
},
end: {
line: 117,
column: 2
}
},
line: 114
}
},
branchMap: {
"0": {
loc: {
start: {
line: 38,
column: 3
},
end: {
line: 38,
column: 97
}
},
type: "if",
locations: [{
start: {
line: 38,
column: 3
},
end: {
line: 38,
column: 97
}
}, {
start: {
line: undefined,
column: undefined
},
end: {
line: undefined,
column: undefined
}
}],
line: 38
},
"1": {
loc: {
start: {
line: 38,
column: 7
},
end: {
line: 38,
column: 74
}
},
type: "binary-expr",
locations: [{
start: {
line: 38,
column: 7
},
end: {
line: 38,
column: 26
}
}, {
start: {
line: 38,
column: 30
},
end: {
line: 38,
column: 74
}
}],
line: 38
},
"2": {
loc: {
start: {
line: 41,
column: 3
},
end: {
line: 41,
column: 29
}
},
type: "if",
locations: [{
start: {
line: 41,
column: 3
},
end: {
line: 41,
column: 29
}
}, {
start: {
line: undefined,
column: undefined
},
end: {
line: undefined,
column: undefined
}
}],
line: 41
},
"3": {
loc: {
start: {
line: 71,
column: 3
},
end: {
line: 92,
column: 4
}
},
type: "if",
locations: [{
start: {
line: 71,
column: 3
},
end: {
line: 92,
column: 4
}
}, {
start: {
line: undefined,
column: undefined
},
end: {
line: undefined,
column: undefined
}
}],
line: 71
},
"4": {
loc: {
start: {
line: 78,
column: 5
},
end: {
line: 84,
column: 6
}
},
type: "if",
locations: [{
start: {
line: 78,
column: 5
},
end: {
line: 84,
column: 6
}
}, {
start: {
line: 80,
column: 12
},
end: {
line: 84,
column: 6
}
}],
line: 78
},
"5": {
loc: {
start: {
line: 97,
column: 3
},
end: {
line: 97,
column: 29
}
},
type: "if",
locations: [{
start: {
line: 97,
column: 3
},
end: {
line: 97,
column: 29
}
}, {
start: {
line: undefined,
column: undefined
},
end: {
line: undefined,
column: undefined
}
}],
line: 97
},
"6": {
loc: {
start: {
line: 107,
column: 2
},
end: {
line: 107,
column: 65
}
},
type: "if",
locations: [{
start: {
line: 107,
column: 2
},
end: {
line: 107,
column: 65
}
}, {
start: {
line: undefined,
column: undefined
},
end: {
line: undefined,
column: undefined
}
}],
line: 107
}
},
s: {
"0": 0,
"1": 0,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0,
"10": 0,
"11": 0,
"12": 0,
"13": 0,
"14": 0,
"15": 0,
"16": 0,
"17": 0,
"18": 0,
"19": 0,
"20": 0,
"21": 0,
"22": 0,
"23": 0,
"24": 0,
"25": 0,
"26": 0,
"27": 0,
"28": 0,
"29": 0,
"30": 0,
"31": 0,
"32": 0,
"33": 0,
"34": 0,
"35": 0,
"36": 0,
"37": 0,
"38": 0,
"39": 0,
"40": 0,
"41": 0,
"42": 0,
"43": 0,
"44": 0,
"45": 0,
"46": 0,
"47": 0,
"48": 0
},
f: {
"0": 0,
"1": 0,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0,
"10": 0,
"11": 0,
"12": 0,
"13": 0
},
b: {
"0": [0, 0],
"1": [0, 0],
"2": [0, 0],
"3": [0, 0],
"4": [0, 0],
"5": [0, 0],
"6": [0, 0]
},
inputSourceMap: {
version: 3,
names: [],
sources: ["svelte.repro"],
sourcesContent: ["<script>\n export let users;\n</script>\n\n<ul>\n {#each users as user}\n <li>{user}</li>\n {/each}\n</ul>"],
mappings: ";;;;;;;;;;;;;;;;;;;;;;;;wBAMS,GAAI;;;;;;;;;GAAT,MAAe;;;;8DAAV,GAAI;;;;;;;;;;4BADL,GAAK;;;gCAAV,MAAI;;;;;;;;;;;;;GADP,MAIK;;;;;;;;2BAHG,GAAK;;;+BAAV,MAAI;;;;;;;;;;;;;;;;oCAAJ,MAAI;;;;;;;;;;;;;OAJK,KAAK;;;;;;;;;;;;;;;;"
},
_coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
hash: "bde7a64d9476cfa52d52cd260594f012b38ab5f6"
};
var coverage = global[gcv] || (global[gcv] = {});
if (!coverage[path] || coverage[path].hash !== hash) {
coverage[path] = coverageData;
}
var actualCoverage = coverage[path];
{
// @ts-ignore
cov_208gup579f = function () {
return actualCoverage;
};
}
return actualCoverage;
}
cov_208gup579f();
/* svelte.repro generated by Svelte v3.49.0 */
import { SvelteComponent, append, destroy_each, detach, element, init, insert, noop, safe_not_equal, set_data, text } from "svelte/internal";
function get_each_context(ctx, list, i) {
cov_208gup579f().f[0]++;
const child_ctx = (cov_208gup579f().s[0]++, ctx.slice());
cov_208gup579f().s[1]++;
child_ctx[1] = list[i];
cov_208gup579f().s[2]++;
return child_ctx;
} // (6:1) {#each users as user}
function create_each_block(ctx) {
cov_208gup579f().f[1]++;
let li;
let t_value = (
/*user*/
cov_208gup579f().s[3]++, ctx[1] + "");
let t;
cov_208gup579f().s[4]++;
return {
c() {
cov_208gup579f().f[2]++;
cov_208gup579f().s[5]++;
li = element("li");
cov_208gup579f().s[6]++;
t = text(t_value);
},
m(target, anchor) {
cov_208gup579f().f[3]++;
cov_208gup579f().s[7]++;
insert(target, li, anchor);
cov_208gup579f().s[8]++;
append(li, t);
},
p(ctx, dirty) {
cov_208gup579f().f[4]++;
cov_208gup579f().s[9]++;
if ((cov_208gup579f().b[1][0]++, dirty &
/*users*/
1) && (cov_208gup579f().b[1][1]++, t_value !== (t_value =
/*user*/
ctx[1] + ""))) {
cov_208gup579f().b[0][0]++;
cov_208gup579f().s[10]++;
set_data(t, t_value);
} else {
cov_208gup579f().b[0][1]++;
}
},
d(detaching) {
cov_208gup579f().f[5]++;
cov_208gup579f().s[11]++;
if (detaching) {
cov_208gup579f().b[2][0]++;
cov_208gup579f().s[12]++;
detach(li);
} else {
cov_208gup579f().b[2][1]++;
}
}
};
}
function create_fragment(ctx) {
cov_208gup579f().f[6]++;
let ul;
let each_value = (
/*users*/
cov_208gup579f().s[13]++, ctx[0]);
let each_blocks = (cov_208gup579f().s[14]++, []);
cov_208gup579f().s[15]++;
for (let i = (cov_208gup579f().s[16]++, 0); i < each_value.length; i += 1) {
cov_208gup579f().s[17]++;
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
}
cov_208gup579f().s[18]++;
return {
c() {
cov_208gup579f().f[7]++;
cov_208gup579f().s[19]++;
ul = element("ul");
cov_208gup579f().s[20]++;
for (let i = (cov_208gup579f().s[21]++, 0); i < each_blocks.length; i += 1) {
cov_208gup579f().s[22]++;
each_blocks[i].c();
}
},
m(target, anchor) {
cov_208gup579f().f[8]++;
cov_208gup579f().s[23]++;
insert(target, ul, anchor);
cov_208gup579f().s[24]++;
for (let i = (cov_208gup579f().s[25]++, 0); i < each_blocks.length; i += 1) {
cov_208gup579f().s[26]++;
each_blocks[i].m(ul, null);
}
},
p(ctx, [dirty]) {
cov_208gup579f().f[9]++;
cov_208gup579f().s[27]++;
if (dirty &
/*users*/
1) {
cov_208gup579f().b[3][0]++;
cov_208gup579f().s[28]++;
each_value =
/*users*/
ctx[0];
let i;
cov_208gup579f().s[29]++;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = (cov_208gup579f().s[30]++, get_each_context(ctx, each_value, i));
cov_208gup579f().s[31]++;
if (each_blocks[i]) {
cov_208gup579f().b[4][0]++;
cov_208gup579f().s[32]++;
each_blocks[i].p(child_ctx, dirty);
} else {
cov_208gup579f().b[4][1]++;
cov_208gup579f().s[33]++;
each_blocks[i] = create_each_block(child_ctx);
cov_208gup579f().s[34]++;
each_blocks[i].c();
cov_208gup579f().s[35]++;
each_blocks[i].m(ul, null);
}
}
cov_208gup579f().s[36]++;
for (; i < each_blocks.length; i += 1) {
cov_208gup579f().s[37]++;
each_blocks[i].d(1);
}
cov_208gup579f().s[38]++;
each_blocks.length = each_value.length;
} else {
cov_208gup579f().b[3][1]++;
}
},
i: noop,
o: noop,
d(detaching) {
cov_208gup579f().f[10]++;
cov_208gup579f().s[39]++;
if (detaching) {
cov_208gup579f().b[5][0]++;
cov_208gup579f().s[40]++;
detach(ul);
} else {
cov_208gup579f().b[5][1]++;
}
cov_208gup579f().s[41]++;
destroy_each(each_blocks, detaching);
}
};
}
function instance($$self, $$props, $$invalidate) {
cov_208gup579f().f[11]++;
let {
users
} = (cov_208gup579f().s[42]++, $$props);
cov_208gup579f().s[43]++;
$$self.$$set = $$props => {
cov_208gup579f().f[12]++;
cov_208gup579f().s[44]++;
if ('users' in $$props) {
cov_208gup579f().b[6][0]++;
cov_208gup579f().s[45]++;
$$invalidate(0, users = $$props.users);
} else {
cov_208gup579f().b[6][1]++;
}
};
cov_208gup579f().s[46]++;
return [users];
}
class Svelte extends SvelteComponent {
constructor(options) {
cov_208gup579f().f[13]++;
cov_208gup579f().s[47]++;
super();
cov_208gup579f().s[48]++;
init(this, options, instance, create_fragment, safe_not_equal, {
users: 0
});
}
}
export default Svelte;
{
"version": 3,
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAMSA,GAAI,GAAJ,GAAI;;;;;;;;;;;;;;;MAATC,MAAe,oBAAf;;;;;;;;;;;;;MAAKD,GAAI,GAAJ,GAAI;QAAA;QAAA;QAAAE;MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;4BADLF,GAAK;;;;6DAAVG,QAAIC;IAAA;;;;;;;;;;;;;;;;;;;;;MADPH,MAIK,oBAJL;;;;;;;;;;;;;;;;;;;;QACQD,GAAK;;;;mCAAVG,QAAIC;;UAAA;;;;;;;;;;;;;;;;;;;;;;;;;wCAAJD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAJSE;iCAAKC",
"names": [
"ctx",
"insert",
"set_data",
"length",
"i",
"users",
"$$props"
],
"sources": [
"svelte.repro"
],
"sourcesContent": [
"<script>\n export let users;\n</script>\n\n<ul>\n {#each users as user}\n <li>{user}</li>\n {/each}\n</ul>"
]
}
<script>
export let users;
</script>
<ul>
{#each users as user}
<li>{user}</li>
{/each}
</ul>
/* svelte.repro generated by Svelte v3.49.0 */
import {
SvelteComponent,
append,
destroy_each,
detach,
element,
init,
insert,
noop,
safe_not_equal,
set_data,
text
} from "svelte/internal";
function get_each_context(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[1] = list[i];
return child_ctx;
}
// (6:1) {#each users as user}
function create_each_block(ctx) {
let li;
let t_value = /*user*/ ctx[1] + "";
let t;
return {
c() {
li = element("li");
t = text(t_value);
},
m(target, anchor) {
insert(target, li, anchor);
append(li, t);
},
p(ctx, dirty) {
if (dirty & /*users*/ 1 && t_value !== (t_value = /*user*/ ctx[1] + "")) set_data(t, t_value);
},
d(detaching) {
if (detaching) detach(li);
}
};
}
function create_fragment(ctx) {
let ul;
let each_value = /*users*/ ctx[0];
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
}
return {
c() {
ul = element("ul");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
},
m(target, anchor) {
insert(target, ul, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(ul, null);
}
},
p(ctx, [dirty]) {
if (dirty & /*users*/ 1) {
each_value = /*users*/ ctx[0];
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context(ctx, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block(child_ctx);
each_blocks[i].c();
each_blocks[i].m(ul, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) detach(ul);
destroy_each(each_blocks, detaching);
}
};
}
function instance($$self, $$props, $$invalidate) {
let { users } = $$props;
$$self.$$set = $$props => {
if ('users' in $$props) $$invalidate(0, users = $$props.users);
};
return [users];
}
class Svelte extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, { users: 0 });
}
}
export default Svelte;
{
"version": 3,
"names": [],
"sources": [
"svelte.repro"
],
"sourcesContent": [
"<script>\n export let users;\n</script>\n\n<ul>\n {#each users as user}\n <li>{user}</li>\n {/each}\n</ul>"
],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;wBAMS,GAAI;;;;;;;;;GAAT,MAAe;;;;8DAAV,GAAI;;;;;;;;;;4BADL,GAAK;;;gCAAV,MAAI;;;;;;;;;;;;;GADP,MAIK;;;;;;;;2BAHG,GAAK;;;+BAAV,MAAI;;;;;;;;;;;;;;;;oCAAJ,MAAI;;;;;;;;;;;;;OAJK,KAAK;;;;;;;;;;;;;;;;"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment