Skip to content

Commit

Permalink
v1.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunlong committed Feb 14, 2022
1 parent a136fb8 commit 04ec5df
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 34 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 1.2.5 (2021-02-12)
## 1.2.8 (2021-02-15)

### ✨ Features

Expand Down
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@ svelte-csv is available on yarn as well. It can be installed with the following
yarn add svelte-csv --save
```

## ℹ️ Usage
## ℹ️ Note on usage with SvelteKit

You need to install `papaparse` manually if you get error `'/node_modules/papaparse/papaparse.min.js?v=8573111b' does not provide an export named 'default'`.
If you are using `svelte-csv` with SvelteKit, you need to configure `svelte.config.js` as follows:

papaparse is available on npm. It can be installed with the following command:

```
npm install papaparse @types/papaparse --save
```

papaparse is available on yarn as well. It can be installed with the following command:

```
yarn add papaparse @types/papaparse --save
kit: {
// ...
vite: {
optimizeDeps: {
include: ['papaparse']
}
}
}
```

## 📚 Useful Features
Expand Down Expand Up @@ -191,7 +190,7 @@ const results = jsonToCSV(jsonData);

## 📜 Changelog

Latest version 1.2.5 (2022-02-12):
Latest version 1.2.8 (2022-02-15):

* Fix `'/node_modules/papaparse/papaparse.min.js?v=8573111b' does not provide an export named 'default`

Expand Down
2 changes: 1 addition & 1 deletion dist/svelte-csv.es.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/svelte-csv.es.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/svelte-csv.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/svelte-csv.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "svelte-csv",
"version": "1.2.7",
"version": "1.2.8",
"main": "dist/svelte-csv.js",
"module": "dist/svelte-csv.es.js",
"jsnext:main": "dist/svelte-csv.es.js",
Expand Down Expand Up @@ -94,6 +94,7 @@
},
"browserslist": "last 2 versions",
"dependencies": {
"@types/papaparse": "^5.3.1",
"papaparse": "^5.3.1"
}
}
6 changes: 3 additions & 3 deletions src/CSVDownloader.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script>
import Papa from 'papaparse';
import PapaParse from 'papaparse';
export let data;
export let filename = 'filename';
export let type = 'link';
export let bom = 2;
function download(data, filename, bom) {
const bomCode = bom ? '\ufeff' : '';
let csvContent = null;
if (typeof data === 'object' && Papa) {
csvContent = Papa.unparse(data);
if (typeof data === 'object') {
csvContent = PapaParse.unparse(data);
} else {
csvContent = data;
}
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { default as CSVDownloader } from './CSVDownloader.svelte';
// export { default as jsonToCSVr } from './jsonToCSV.svelte';
// export { default as readRemoteFile } from './readRemoteFile.svelte';
// export { default as readString } from './readString.svelte';
export { default as jsonToCSVr } from './jsonToCSV.svelte';
export { default as readRemoteFile } from './readRemoteFile.svelte';
export { default as readString } from './readString.svelte';
4 changes: 2 additions & 2 deletions src/jsonToCSV.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
import * as Papa from 'papaparse';
import PapaParse from 'papaparse';
export function jsonToCSV(json, options) {
return Papa.unparse(json, options);
return PapaParse.unparse(json, options);
}
</script>
4 changes: 2 additions & 2 deletions src/readRemoteFile.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
import * as Papa from 'papaparse';
import PapaParse from 'papaparse';
export function readRemoteFile(url, options) {
Papa.parse(url, Object.assign({}, { download: true }, options));
PapaParse.parse(url, Object.assign({}, { download: true }, options));
}
</script>
4 changes: 2 additions & 2 deletions src/readString.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
import * as Papa from 'papaparse';
import PapaParse from 'papaparse';
export function readString(str, options) {
return Papa.parse(str, options);
return PapaParse.parse(str, options);
}
</script>
2 changes: 1 addition & 1 deletion supports/svelte-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
},
"type": "module",
"dependencies": {
"svelte-csv": "file:../.."
"svelte-csv": "^1.2.8"
}
}
2 changes: 1 addition & 1 deletion supports/svelte-kit/src/routes/index.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { CSVDownloader } from 'svelte-csv/src';
import { CSVDownloader } from 'svelte-csv';
</script>

<CSVDownloader
Expand Down
7 changes: 6 additions & 1 deletion supports/svelte-kit/svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ const config = {
preprocess: preprocess(),

kit: {
adapter: adapter()
adapter: adapter(),
vite: {
optimizeDeps: {
include: ['papaparse']
}
}
}
};

Expand Down

0 comments on commit 04ec5df

Please sign in to comment.