GithubHelp home page GithubHelp logo

svelte-fragment-divider's People

Contributors

floratmin avatar mojoaxel avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

svelte-fragment-divider's Issues

Error because of `bind:value`

I get an error dividing the following simple svelte component. The error is caused by the bind shortcut bind:value.

minimal svelte component (Example.svelte)

<script>
	let value;
</script>

<div>
	<h3>Selected: {value}</h3>
	<select bind:value>
		<option value="light">Light</option>
		<option value="dark">Dark</option>
	</select>
</div>

Test-setup (divideSvelteFile.js)

import fs from 'fs';
import path from 'path';
import { svelteFragmentDivider } from '@floratmin/svelte-fragment-divider';

const fileName = './Example.svelte';
const svelteFile = fs.readFileSync(path.resolve(fileName), 'utf-8');
const fragments = svelteFragmentDivider(svelteFile, fileName);
console.log(fragments);

Running this script results in an error:

Error

> node ./divideSvelteFile.js

node_modules/@floratmin/svelte-fragment-divider/dist/divideFragments.js:97
        throw new Error(`${errors[0]}${fileName ? ` in file ${fileName}` : ''}\n${errors[1]}`);
              ^

Error: TypeError: Cannot read properties of undefined (reading 'start') in file ./Example.svelte
undefined
    at svelteJsParser (node_modules/@floratmin/svelte-fragment-divider/dist/divideFragments.js:97:15)
    at node_modules/@floratmin/svelte-fragment-divider/dist/divideFragments.js:78:98
    at Array.flatMap (<anonymous>)
    at svelteFragmentDivider (node_modules/@floratmin/svelte-fragment-divider/dist/divideFragments.js:78:76)
    at file:///build/divideSvelteFile.js:8:19
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

Environment:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.