1
0
mirror of synced 2024-11-21 21:06:04 +03:00

chore: Build config fixes, modules paths correction

This commit is contained in:
Zaytsev Kirill 2020-10-11 11:41:32 +03:00
parent 45f29ff27a
commit 713a2bab51
15 changed files with 84 additions and 56 deletions

View File

@ -1,34 +1,35 @@
import commonjs from '@rollup/plugin-commonjs' // Convert CommonJS modules to ES6
import buble from '@rollup/plugin-buble' // Transpile/polyfill with reasonable browser support
import autoExternal from 'rollup-plugin-auto-external'
import vue from 'rollup-plugin-vue' // Handle .vue SFC files
import buble from '@rollup/plugin-buble' // Transpile/polyfill with reasonable browser support
import commonjs from '@rollup/plugin-commonjs' // Convert CommonJS modules to ES6
import { terser } from 'rollup-plugin-terser'
import typescript from '@rollup/plugin-typescript'
import vue from 'rollup-plugin-vue'
// noinspection JSUnusedGlobalSymbols
export default {
input: 'src/Formulario.js', // Path relative to package.json
output: [
{
name: 'Formulario',
exports: 'default',
globals: {
'is-plain-object': 'isPlainObject',
'nanoid/non-secure': 'nanoid',
'is-url': 'isUrl',
},
sourcemap: false
}
],
input: 'src/index.ts',
output: [{
name: 'Formulario',
exports: 'default',
globals: {
'is-plain-object': 'isPlainObject',
'is-url': 'isUrl',
'nanoid/non-secure': 'nanoid',
},
sourcemap: false,
}],
external: ['nanoid/non-secure'],
plugins: [
commonjs(),
autoExternal(),
typescript({ sourceMap: false }),
vue({
css: true, // Dynamically inject css as a <style> tag
compileTemplate: true // Explicitly convert template to render function
}),
buble({
objectAssign: 'Object.assign'
objectAssign: 'Object.assign',
}), // Transpile to ES5,
terser()
terser(),
]
}

View File

@ -1,36 +1,39 @@
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs' // Convert CommonJS modules to ES6
import buble from '@rollup/plugin-buble' // Transpile/polyfill with reasonable browser support
import vue from 'rollup-plugin-vue' // Handle .vue SFC files
import internal from 'rollup-plugin-internal'
import resolve from '@rollup/plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'
import typescript from '@rollup/plugin-typescript'
import vue from 'rollup-plugin-vue' // Handle .vue SFC files
// noinspection JSUnusedGlobalSymbols
export default {
input: 'src/Formulario.js', // Path relative to package.json
input: 'src/index.ts', // Path relative to package.json
output: {
name: 'VueFormulario',
exports: 'default',
format: 'iife',
globals: {
'is-plain-object': 'isPlainObject',
'nanoid/non-secure': 'nanoid',
'is-url': 'isUrl',
}
'nanoid/non-secure': 'nanoid',
},
},
plugins: [
resolve({
browser: true,
preferBuiltins: false
preferBuiltins: false,
}),
commonjs(),
internal(['is-plain-object', 'nanoid/non-secure', 'is-url']),
typescript({ sourceMap: false }),
vue({
css: true, // Dynamically inject css as a <style> tag
compileTemplate: true // Explicitly convert template to render function
}),
buble({
objectAssign: 'Object.assign'
objectAssign: 'Object.assign',
}), // Transpile to ES5,
terser()
terser(),
]
}

View File

@ -1,5 +1,5 @@
import Vue from 'vue'
import VueFormulario from '../src/Formulario'
import VueFormulario from '@/index.ts'
import FormulateSpecimens from './FormulateSpecimens.vue'
Vue.config.productionTip = false

View File

@ -16,7 +16,7 @@
"main": "dist/formulario.umd.js",
"module": "dist/formulario.esm.js",
"browser": {
"./sfc": "src/Formulario.js"
"./sfc": "src/index.ts"
},
"unpkg": "dist/formulario.min.js",
"dependencies": {
@ -31,9 +31,11 @@
"@babel/core": "^7.9.6",
"@babel/plugin-transform-modules-commonjs": "^7.9.6",
"@babel/preset-env": "^7.9.6",
"@rollup/plugin-alias": "^3.1.1",
"@rollup/plugin-buble": "^0.21.3",
"@rollup/plugin-commonjs": "^11.1.0",
"@rollup/plugin-node-resolve": "^7.1.3",
"@rollup/plugin-typescript": "^6.0.0",
"@types/is-url": "^1.2.28",
"@types/jest": "^26.0.14",
"@types/nanoid": "^2.1.0",

View File

@ -1,17 +1,17 @@
import { VueConstructor } from 'vue'
import library from './libs/library'
import rules from './validation/rules'
import mimes from './libs/mimes'
import FileUpload from './FileUpload'
import RuleValidationMessages from './RuleValidationMessages'
import { arrayify, has } from './libs/utils'
import isPlainObject from 'is-plain-object'
import fauxUploader from './libs/faux-uploader'
import library from '@/libs/library'
import rules from '@/validation/rules'
import mimes from '@/libs/mimes'
import FileUpload from '@/FileUpload'
import RuleValidationMessages from '@/RuleValidationMessages'
import { arrayify, has } from '@/libs/utils'
import fauxUploader from '@/libs/faux-uploader'
import FormularioForm from '@/FormularioForm.vue'
import FormularioInput from '@/FormularioInput.vue'
import FormularioGrouping from './FormularioGrouping.vue'
import FormularioGrouping from '@/FormularioGrouping.vue'
import { ObjectType } from '@/common.types'
import { ValidationContext } from '@/validation/types'
@ -39,7 +39,7 @@ interface FormularioOptions {
/**
* The base formulario library.
*/
class Formulario {
export default class Formulario {
public options: FormularioOptions
public defaults: FormularioOptions
public registry: Map<string, FormularioForm>
@ -299,7 +299,3 @@ class Formulario {
return new FileUpload(data, context, this.options)
}
}
export { Formulario }
export default new Formulario()

View File

@ -1,4 +1,4 @@
import { Formulario } from '@/Formulario'
import Formulario from '@/Formulario'
import FormularioInput from '@/FormularioInput.vue'
import { ValidationContext } from '@/validation/types'

View File

@ -1,2 +1 @@
export type ArrayType = [any]
export type ObjectType = { [key: string]: any }

3
src/index.ts Normal file
View File

@ -0,0 +1,3 @@
import Formulario from '@/Formulario.ts'
export default new Formulario()

3
src/shims-ext.d.ts vendored
View File

@ -1,5 +1,4 @@
import Vue from 'vue'
import { Formulario } from '@/Formulario'
import Formulario from '@/Formulario'
declare module 'vue/types/vue' {
interface VueRoute {

View File

@ -1,4 +1,4 @@
import Formulario from '@/Formulario.ts'
import Formulario from '@/index.ts'
describe('Formulario', () => {
it('can merge simple object', () => {

View File

@ -2,7 +2,7 @@ import Vue from 'vue'
import { mount } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import FormSubmission from '@/FormSubmission.ts'
import Formulario from '@/Formulario.ts'
import Formulario from '@/index.ts'
import FormularioForm from '@/FormularioForm.vue'
function validationMessages (instance) {

View File

@ -1,7 +1,7 @@
import Vue from 'vue'
import { mount } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import Formulario from '@/Formulario.ts'
import Formulario from '@/index.ts'
import FormularioForm from '@/FormularioForm.vue'
import FormularioGrouping from '@/FormularioGrouping.vue'

View File

@ -2,7 +2,7 @@ import Vue from 'vue'
import flushPromises from 'flush-promises'
import { mount } from '@vue/test-utils'
import Formulario from '@/Formulario.ts'
import Formulario from '@/index.ts'
import FormularioForm from '@/FormularioForm.vue'
import FormularioInput from '@/FormularioInput.vue'

View File

@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "ES2019",
"module": "commonjs",
"target": "es2015",
"module": "es2015",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
@ -28,6 +28,7 @@
]
},
"include": [
"src/**/*.js",
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",

View File

@ -1228,6 +1228,13 @@
"@nodelib/fs.scandir" "2.1.3"
fastq "^1.6.0"
"@rollup/plugin-alias@^3.1.1":
version "3.1.1"
resolved "https://registry.yarnpkg.com/@rollup/plugin-alias/-/plugin-alias-3.1.1.tgz#bb96cf37fefeb0a953a6566c284855c7d1cd290c"
integrity sha512-hNcQY4bpBUIvxekd26DBPgF7BT4mKVNDF5tBG4Zi+3IgwLxGYRY0itHs9D0oLVwXM5pvJDWJlBQro+au8WaUWw==
dependencies:
slash "^3.0.0"
"@rollup/plugin-buble@^0.21.3":
version "0.21.3"
resolved "https://registry.yarnpkg.com/@rollup/plugin-buble/-/plugin-buble-0.21.3.tgz#1649a915b1d051a4f430d40e7734a7f67a69b33e"
@ -1261,6 +1268,14 @@
is-module "^1.0.0"
resolve "^1.14.2"
"@rollup/plugin-typescript@^6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-6.0.0.tgz#08635d9d04dc3a099ef0150c289ba5735200bc63"
integrity sha512-Y5U2L4eaF3wUSgCZRMdvNmuzWkKMyN3OwvhAdbzAi5sUqedaBk/XbzO4T7RlViDJ78MOPhwAIv2FtId/jhMtbg==
dependencies:
"@rollup/pluginutils" "^3.1.0"
resolve "^1.17.0"
"@rollup/pluginutils@^3.0.8":
version "3.0.10"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.0.10.tgz#a659b9025920378494cd8f8c59fbf9b3a50d5f12"
@ -1270,6 +1285,15 @@
estree-walker "^1.0.1"
picomatch "^2.2.2"
"@rollup/pluginutils@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b"
integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==
dependencies:
"@types/estree" "0.0.39"
estree-walker "^1.0.1"
picomatch "^2.2.2"
"@sinonjs/commons@^1.7.0":
version "1.8.1"
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.1.tgz#e7df00f98a203324f6dc7cc606cad9d4a8ab2217"
@ -6573,11 +6597,11 @@ is-promise@^2.0.0:
integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==
is-reference@^1.1.2:
version "1.1.4"
resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.1.4.tgz#3f95849886ddb70256a3e6d062b1a68c13c51427"
integrity sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw==
version "1.2.1"
resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7"
integrity sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==
dependencies:
"@types/estree" "0.0.39"
"@types/estree" "*"
is-regex@^1.0.3, is-regex@^1.0.4, is-regex@^1.0.5:
version "1.0.5"