├── .babelrc ├── .gitignore ├── .npmrc ├── CHANGELOG.md ├── Gruntfile.js ├── README.md ├── dist ├── vue-script2.js └── vue-script2.min.js ├── package-lock.json ├── package.json └── src └── index.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"] 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | lib 2 | coverage 3 | node_modules 4 | .DS_Store 5 | *.log 6 | *.swp 7 | *~ 8 | *.ignore -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | save-prefix = '' -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ### 2.1.0 2 | 3 | - Better handling of simultaneously loaded components ([#12](https://github.com/taoeffect/vue-script2/issues/12) - thanks **[@vgavro](https://github.com/vgavro)**) 4 | - Emit vue events for `loaded` and `error` ([#31](https://github.com/taoeffect/vue-script2/issues/31) - thanks **[@vgavro](https://github.com/vgavro)**) 5 | - Updated all dev dependencies and switched from uglify to terser 6 | 7 | ### 2.0.3 8 | 9 | - Fix inline-source containing HTML entities (via **[@andrispraulitis](https://github.com/andrispraulitis)**) 10 | 11 | ### 2.0.2 12 | 13 | - IE Support (via **[@akhoury](https://github.com/akhoury)**) 14 | - Use `render` function instead of `template` (via **[@bichikim](https://github.com/bichikim)**) 15 | - Updated dependencies 16 | - Removed broken `grunt-rollup` and updated `Gruntfile.js` accordingly 17 | 18 | ## Pre 2.0.2 19 | 20 | - __2.0.1__ - `crossorigin` Safari fix (thanks [@mingchuno](https://github.com/mingchuno)!) 21 | - __2.0.0__ - Vue 2.x compatible. Requires Vue 2.x. Use 1.2.2 for Vue 1.x. 22 | - __1.2.2__ - Fixes broken `crossorigin` attribute (thx @grempe!) 23 | - __1.2.1__ - Just a bit of perfectionism to fix a non-issue issue 24 | - __1.2.0__ - Added `VueScript2.load` imperative loading 25 | - __1.1.2__ - Another bump to get npm.org to display `script2ify` in the README 26 | - __1.1.1__ - Identical to `1.1.0`, just adds needed package.json info. 27 | - __1.1.0__ - Adds special support for `async` attribute. 28 | - __1.0.0__ - Initial release. 29 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | const rollup = require('rollup') 2 | const babel = require('rollup-plugin-babel') 3 | const terser = require('rollup-plugin-terser').terser 4 | const fs = require('fs') 5 | 6 | module.exports = function (grunt) { 7 | require('load-grunt-tasks')(grunt) 8 | 9 | var pkg = grunt.file.readJSON('package.json') 10 | var file = pkg['jsnext:main'] 11 | var main = fs.readFileSync(file, 'utf-8') 12 | var v1 = main.match(/version: '([\d.]+)'/)[1] 13 | if (v1 !== pkg.version) { 14 | console.log(`Updating version in ${file}: ${v1} => ${pkg.version}`) 15 | main = main.replace(`version: '${v1}'`, `version: '${pkg.version}'`) 16 | fs.writeFileSync(file, main) 17 | } 18 | 19 | var year = new Date().getFullYear() 20 | year = year === 2016 ? year : `2016-${year}` 21 | var banner = `/*! 22 | * ${pkg.name} v${pkg.version} 23 | * (c) ${year} Greg Slepak 24 | * @license MIT License 25 | */` 26 | 27 | function pick (o, props) { 28 | var x = {} 29 | props.forEach(k => { x[k] = o[k] }) 30 | return x 31 | } 32 | 33 | grunt.initConfig({ 34 | pkg: pkg, 35 | checkDependencies: { this: { options: { install: true } } }, 36 | exec: { 37 | eslint: 'node ./node_modules/eslint/bin/eslint.js "**/*.js"' 38 | }, 39 | rollup: { 40 | umd: { 41 | input: 'src/index.js', 42 | plugins: [babel({ exclude: './node_modules/**' })], 43 | output: { 44 | file: `dist/${pkg.name}.js`, 45 | format: 'umd', 46 | name: camelCase(pkg.name), 47 | banner 48 | } 49 | }, 50 | ugly: { 51 | input: 'src/index.js', 52 | plugins: [ 53 | babel({ exclude: './node_modules/**' }), 54 | terser({ output: { preamble: banner } }) 55 | ], 56 | output: { 57 | file: `dist/${pkg.name}.min.js`, 58 | format: 'umd', 59 | name: camelCase(pkg.name) 60 | } 61 | } 62 | } 63 | }) 64 | 65 | grunt.registerMultiTask('rollup', async function () { 66 | // grunt.log.writeln(this.target + ': ', this.data) 67 | var done = this.async() 68 | // https://rollupjs.org/guide/en#javascript-api 69 | const bundle = await rollup.rollup(pick(this.data, ['input', 'plugins'])) 70 | await bundle.write(this.data.output) 71 | done() 72 | }) 73 | 74 | grunt.registerTask('default', ['exec:eslint', 'rollup']) 75 | } 76 | 77 | function camelCase (s) { 78 | return s.replace(/(?:^|[-_/])(\w)/g, (_, c) => c ? c.toUpperCase() : '') 79 | } 80 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VueScript2 - Simple, Familiar Asynchronous Script Loading 2 | 3 | VueScript2 brings back the `