rollup-plugin-svelte
Advanced tools
Comparing version 1.3.0 to 1.3.1
# rollup-plugin-svelte changelog | ||
## 1.3.1 | ||
* Sanitize constructor names | ||
## 1.3.0 | ||
@@ -4,0 +8,0 @@ |
@@ -7,2 +7,15 @@ 'use strict'; | ||
function sanitize ( input ) { | ||
return path.basename( input ) | ||
.replace( path.extname( input ), '' ) | ||
.replace( /[^a-zA-Z_$0-9]+/g, '_' ) | ||
.replace( /^_/, '' ) | ||
.replace( /_$/, '' ) | ||
.replace( /^(\d)/, '_$1' ); | ||
} | ||
function capitalize ( str ) { | ||
return str[0] + str.slice( 1 ); | ||
} | ||
function svelte$1 ( options ) { | ||
@@ -22,4 +35,3 @@ if ( options === void 0 ) options = {}; | ||
var name = path.basename( id ).replace( path.extname( id ), '' ); | ||
name = "" + (name[0].toUpperCase()) + (name.slice( 1 )); | ||
var name = capitalize( sanitize( id ) ); | ||
@@ -26,0 +38,0 @@ return svelte.compile( code, { |
@@ -5,2 +5,15 @@ import { basename, extname } from 'path'; | ||
function sanitize ( input ) { | ||
return basename( input ) | ||
.replace( extname( input ), '' ) | ||
.replace( /[^a-zA-Z_$0-9]+/g, '_' ) | ||
.replace( /^_/, '' ) | ||
.replace( /_$/, '' ) | ||
.replace( /^(\d)/, '_$1' ); | ||
} | ||
function capitalize ( str ) { | ||
return str[0] + str.slice( 1 ); | ||
} | ||
function svelte$1 ( options ) { | ||
@@ -20,4 +33,3 @@ if ( options === void 0 ) options = {}; | ||
var name = basename( id ).replace( extname( id ), '' ); | ||
name = "" + (name[0].toUpperCase()) + (name.slice( 1 )); | ||
var name = capitalize( sanitize( id ) ); | ||
@@ -24,0 +36,0 @@ return compile( code, { |
{ | ||
"name": "rollup-plugin-svelte", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Compile Svelte components with Rollup", | ||
@@ -5,0 +5,0 @@ "main": "dist/rollup-plugin-svelte.cjs.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6205
85