Skip to content

Commit b004343

Browse files
Merge pull request #74 from browserstack/AXE-342-legal-complaint-changes-for-dom-forge-core
feat: adding custom stub
2 parents 67dbf90 + 10bd5a0 commit b004343

File tree

6 files changed

+39
-18
lines changed

6 files changed

+39
-18
lines changed

Gruntfile.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module.exports = function (grunt) {
1515
grunt.loadTasks('build/tasks');
1616

1717
var langs;
18+
var wrapper = !!grunt.option('wrapper');
1819
if (grunt.option('lang')) {
1920
langs = (grunt.option('lang') || '').split(/[,;]/g).map(function (lang) {
2021
lang = lang.trim();
@@ -85,11 +86,11 @@ module.exports = function (grunt) {
8586
files: langs.map(function (lang, i) {
8687
return {
8788
src: [
88-
'lib/intro.stub',
89+
wrapper ? 'lib/custom/intro.stub' : 'lib/intro.stub',
8990
'<%= concat.engine.coreFiles %>',
9091
// include rules / checks / commons
9192
'<%= configure.rules.files[' + i + '].dest.auto %>',
92-
'lib/outro.stub'
93+
wrapper ? 'lib/custom/outro.stub' : 'lib/outro.stub'
9394
],
9495
dest: 'axe' + lang + '.js'
9596
};
@@ -127,7 +128,8 @@ module.exports = function (grunt) {
127128
entry: 'lib/commons/aria/index.js',
128129
destFile: 'doc/aria-supported.md',
129130
options: {
130-
langs: langs
131+
langs: langs,
132+
wrapper: wrapper
131133
},
132134
listType: 'unsupported' // Possible values for listType: 'supported', 'unsupported', 'all'
133135
}

build/tasks/aria-supported.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ module.exports = function (grunt) {
1616
* hence cannot be required at the top of the file.
1717
*/
1818
const done = this.async();
19-
const { langs } = this.options();
19+
const { langs, wrapper } = this.options();
20+
if (wrapper) return true;
2021
const fileNameSuffix = langs && langs.length > 0 ? `${langs[0]}` : '';
2122
const axe = require(`../../axe${fileNameSuffix}`);
2223
const listType = this.data.listType.toLowerCase();

lib/custom/intro.stub

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*! axe v<%= pkg.version %>
2+
* Copyright (c) 2015 - <%= grunt.template.today("yyyy") %> Deque Systems, Inc.
3+
*
4+
* Your use of this Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
7+
*
8+
* This entire copyright notice must appear in every copy of this file you
9+
* distribute or in any file that contains substantial portions of this source
10+
* code.
11+
*/
12+
const createAxe = () => (function axeFunction (window) {
13+
// A window reference is required to access the axe object in a "global".
14+
var global = window;
15+
var document = window.document;

lib/custom/outro.stub

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
}( typeof window === 'object' ? window : this ));

package-lock.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"develop": "grunt dev --force",
7272
"api-docs": "jsdoc --configure .jsdoc.json",
7373
"build": "grunt",
74+
"build:wrapper": "grunt --wrapper=true",
7475
"eslint": "eslint --color --format stylish '{lib,test,build,doc}/**/*.js' 'Gruntfile.js'",
7576
"test": "npm run test:tsc && run-s \"test:unit:* -- {@}\" --",
7677
"test:tsc": "tsc",

0 commit comments

Comments
 (0)