switch from pika to rollup

This commit is contained in:
Nolan Lawson 2020-05-09 19:39:47 -07:00
parent 364d757666
commit 44aa66de1c
7 changed files with 270 additions and 2731 deletions

121
.gitignore vendored
View File

@ -1,2 +1,119 @@
/pkg
/node_modules
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.pnp.*
/dist

View File

@ -2,22 +2,14 @@
"name": "lite-emoji-picker",
"version": "1.0.0",
"description": "Lightweight emoji picker based on IndexedDB",
"main": "src/index.js",
"@pika/pack": {
"pipeline": [
[
"@pika/plugin-standard-pkg"
],
[
"@pika/plugin-build-node"
],
[
"@pika/plugin-build-web"
]
]
},
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
"files": [
"dist"
],
"sideEffects": false,
"scripts": {
"build": "pika-pack",
"build": "rollup -c",
"lint": "standard",
"lint:fix": "standard --fix",
"test": "echo \"Error: no test specified\" && exit 1"
@ -38,13 +30,13 @@
},
"homepage": "https://github.com/nolanlawson/lite-emoji-picker#readme",
"devDependencies": {
"@pika/pack": "^0.5.0",
"@pika/plugin-build-node": "^0.9.2",
"@pika/plugin-build-web": "^0.9.2",
"@pika/plugin-standard-pkg": "^0.9.2",
"@pika/plugin-ts-standard-pkg": "^0.9.2",
"emojibase-data": "^5.0.1",
"standard": "^14.3.3"
"rollup": "^2.8.2",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-svelte": "^5.2.1",
"standard": "^14.3.3",
"svelte": "^3.22.2"
},
"standard": {
"global": [

29
rollup.config.js Normal file
View File

@ -0,0 +1,29 @@
import cjs from 'rollup-plugin-commonjs'
import resolve from 'rollup-plugin-node-resolve'
import svelte from 'rollup-plugin-svelte'
const baseConfig = {
input: './src/index.js',
plugins: [
resolve(),
cjs(),
svelte()
]
}
export default [
{
...baseConfig,
output: {
file: 'dist/index.cjs.js',
format: 'cjs'
}
},
{
...baseConfig,
output: {
file: 'dist/index.es.js',
format: 'es'
}
}
]

View File

@ -46,7 +46,7 @@ export class IndexedDBEngine {
})
}
getEmojiBySearchPrefix(prefix) {
getEmojiBySearchPrefix (prefix) {
prefix = prefix.toLowerCase()
return dbPromise(this._db, STORE_EMOJI, MODE_READONLY, (emojiStore, cb) => {
const range = IDBKeyRange.bound(prefix, prefix + '\uffff', false, true)
@ -56,7 +56,7 @@ export class IndexedDBEngine {
})
}
getEmojiByShortcode(shortcode) {
getEmojiByShortcode (shortcode) {
shortcode = shortcode.toLowerCase()
return dbPromise(this._db, STORE_EMOJI, MODE_READONLY, (emojiStore, cb) => {
const range = IDBKeyRange.only(shortcode)
@ -69,7 +69,7 @@ export class IndexedDBEngine {
})
}
getEmojiByUnicode(unicode) {
getEmojiByUnicode (unicode) {
return dbPromise(this._db, STORE_EMOJI, MODE_READONLY, (emojiStore, cb) => {
emojiStore.get(unicode).onsuccess = e => cb(e.target.result)
})

View File

@ -13,4 +13,4 @@ export const FIELD_ORDER = 'order'
export const INDEX_GROUP_AND_ORDER = 'group-order'
export const KEY_VERSION = 'version'
export const MODE_READONLY = 'readonly'
export const MODE_READWRITE= 'readwrite'
export const MODE_READWRITE = 'readwrite'

View File

@ -2,7 +2,7 @@ import { IndexedDBEngine } from './IndexedDBEngine'
let idbEngine
function verifyNonEmptyString(str) {
function verifyNonEmptyString (str) {
if (typeof str !== 'string' || !str) {
throw new Error('expected a non-empty string, got: ' + str)
}

2807
yarn.lock

File diff suppressed because it is too large Load Diff