diff --git a/Gruntfile.js b/Gruntfile.js index 0a888fe1..47d9e078 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -15,6 +15,7 @@ module.exports = function (grunt) { grunt.loadTasks('build/tasks'); var langs; + var wrapper = !!grunt.option('wrapper'); if (grunt.option('lang')) { langs = (grunt.option('lang') || '').split(/[,;]/g).map(function (lang) { lang = lang.trim(); @@ -85,11 +86,11 @@ module.exports = function (grunt) { files: langs.map(function (lang, i) { return { src: [ - 'lib/intro.stub', + wrapper ? 'lib/custom/intro.stub' : 'lib/intro.stub', '<%= concat.engine.coreFiles %>', // include rules / checks / commons '<%= configure.rules.files[' + i + '].dest.auto %>', - 'lib/outro.stub' + wrapper ? 'lib/custom/outro.stub' : 'lib/outro.stub' ], dest: 'axe' + lang + '.js' }; @@ -127,7 +128,8 @@ module.exports = function (grunt) { entry: 'lib/commons/aria/index.js', destFile: 'doc/aria-supported.md', options: { - langs: langs + langs: langs, + wrapper: wrapper }, listType: 'unsupported' // Possible values for listType: 'supported', 'unsupported', 'all' } diff --git a/build/tasks/aria-supported.js b/build/tasks/aria-supported.js index 257b52ed..efe43437 100644 --- a/build/tasks/aria-supported.js +++ b/build/tasks/aria-supported.js @@ -16,7 +16,8 @@ module.exports = function (grunt) { * hence cannot be required at the top of the file. */ const done = this.async(); - const { langs } = this.options(); + const { langs, wrapper } = this.options(); + if (wrapper) return true; const fileNameSuffix = langs && langs.length > 0 ? `${langs[0]}` : ''; const axe = require(`../../axe${fileNameSuffix}`); const listType = this.data.listType.toLowerCase(); diff --git a/lib/custom/intro.stub b/lib/custom/intro.stub new file mode 100644 index 00000000..9ed8b3c4 --- /dev/null +++ b/lib/custom/intro.stub @@ -0,0 +1,15 @@ +/*! axe v<%= pkg.version %> + * Copyright (c) 2015 - <%= grunt.template.today("yyyy") %> Deque Systems, Inc. + * + * Your use of this Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This entire copyright notice must appear in every copy of this file you + * distribute or in any file that contains substantial portions of this source + * code. + */ +const createAxe = () => (function axeFunction (window) { + // A window reference is required to access the axe object in a "global". + var global = window; + var document = window.document; diff --git a/lib/custom/outro.stub b/lib/custom/outro.stub new file mode 100644 index 00000000..19fd22a6 --- /dev/null +++ b/lib/custom/outro.stub @@ -0,0 +1,2 @@ + +}( typeof window === 'object' ? window : this )); diff --git a/package-lock.json b/package-lock.json index b983f73d..3ac33cf7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3108,12 +3108,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -5693,9 +5693,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" @@ -15528,12 +15528,12 @@ } }, "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "requires": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" } }, "browser-driver-manager": { @@ -17470,9 +17470,9 @@ } }, "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "requires": { "to-regex-range": "^5.0.1" diff --git a/package.json b/package.json index 6c9a3e1f..5d5beb35 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "develop": "grunt dev --force", "api-docs": "jsdoc --configure .jsdoc.json", "build": "grunt", + "build:wrapper": "grunt --wrapper=true", "eslint": "eslint --color --format stylish '{lib,test,build,doc}/**/*.js' 'Gruntfile.js'", "test": "npm run test:tsc && run-s \"test:unit:* -- {@}\" --", "test:tsc": "tsc",