first commit
This commit is contained in:
3
app_vue/node_modules/@soda/get-current-script/.editorconfig
generated
vendored
Normal file
3
app_vue/node_modules/@soda/get-current-script/.editorconfig
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
36
app_vue/node_modules/@soda/get-current-script/.github/workflows/main.yml
generated
vendored
Normal file
36
app_vue/node_modules/@soda/get-current-script/.github/workflows/main.yml
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
# This is a basic workflow to help you get started with Actions
|
||||
|
||||
name: CI
|
||||
|
||||
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||
# events but only for the master branch
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
# The type of runner that the job will run on
|
||||
runs-on: windows-latest
|
||||
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '12.x'
|
||||
|
||||
|
||||
# Runs a single command using the runners shell
|
||||
- name: Install dependencies
|
||||
run: yarn --frozen-lockfile
|
||||
|
||||
# Runs a set of commands using the runners shell
|
||||
# As there seems to be issues like "socket hang up" in the github actions environment when testing all browsers altogether, I run the browser tests sequentially in the ci script
|
||||
- name: Run the test
|
||||
run: yarn ci
|
23
app_vue/node_modules/@soda/get-current-script/LICENSE
generated
vendored
Normal file
23
app_vue/node_modules/@soda/get-current-script/LICENSE
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2020 Haoqun Jiang
|
||||
Copyright (c) 2015 Adam Miller
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
20
app_vue/node_modules/@soda/get-current-script/README.md
generated
vendored
Normal file
20
app_vue/node_modules/@soda/get-current-script/README.md
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
# @soda/get-current-script 
|
||||
|
||||
It is basically a function that returns `document.currentScript` but with support for IE9-11, thanks to https://github.com/amiller-gh/currentScript-polyfill.
|
||||
|
||||
It also works around a [Firefox issue](https://bugzilla.mozilla.org/show_bug.cgi?id=1620505) when the script is called in a microtask, which makes `document.currentScript` unusable in a webpack dynamic-imported chunk.
|
||||
|
||||
It is shipped as a utility function rather than a polyfill, because we can't easily tell if the `document.currentScript` is returning `null` due to the Firefox issue or because it's running in an event handler / a callback.
|
||||
|
||||
The implementation here may not adhere strictly to `document.currentScript` spec when called in async code or in a callback. In these situations the spec calls for `document.currentScript` to return `null`. However, for the grand majority of your `document.currentScript` needs, this utility will do the job!
|
||||
|
||||
## Usage
|
||||
|
||||
```sh
|
||||
npm i @soda/get-current-script
|
||||
```
|
||||
|
||||
```js
|
||||
const getCurrentScript = require('@soda/get-current-script')
|
||||
const script = getCurrentScript() // the current executing <script> element
|
||||
```
|
9
app_vue/node_modules/@soda/get-current-script/fixtures/log-src-in-microtask.js
generated
vendored
Normal file
9
app_vue/node_modules/@soda/get-current-script/fixtures/log-src-in-microtask.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
var app = document.getElementById('app')
|
||||
if (typeof Promise === 'undefined') {
|
||||
// skip this test in IE
|
||||
app.textContent = window.getCurrentScript().src
|
||||
} else {
|
||||
Promise.resolve().then(function() {
|
||||
app.textContent = window.getCurrentScript().src
|
||||
})
|
||||
}
|
1
app_vue/node_modules/@soda/get-current-script/fixtures/log-src.js
generated
vendored
Normal file
1
app_vue/node_modules/@soda/get-current-script/fixtures/log-src.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
document.getElementById('app').textContent = window.getCurrentScript().src
|
13
app_vue/node_modules/@soda/get-current-script/fixtures/test-microtask.html
generated
vendored
Normal file
13
app_vue/node_modules/@soda/get-current-script/fixtures/test-microtask.html
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="../index.js"></script>
|
||||
<script src="./log-src-in-microtask.js"></script>
|
||||
</body>
|
||||
</html>
|
13
app_vue/node_modules/@soda/get-current-script/fixtures/test-polyfill.html
generated
vendored
Normal file
13
app_vue/node_modules/@soda/get-current-script/fixtures/test-polyfill.html
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="../index.js"></script>
|
||||
<script src="./test-polyfill.js"></script>
|
||||
</body>
|
||||
</html>
|
7
app_vue/node_modules/@soda/get-current-script/fixtures/test-polyfill.js
generated
vendored
Normal file
7
app_vue/node_modules/@soda/get-current-script/fixtures/test-polyfill.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
if (!('currentScript' in document)) {
|
||||
Object.defineProperty(document, 'currentScript', { get: window.getCurrentScript })
|
||||
}
|
||||
|
||||
if (document.currentScript) {
|
||||
document.getElementById('app').textContent = 'It works!'
|
||||
}
|
13
app_vue/node_modules/@soda/get-current-script/fixtures/test.html
generated
vendored
Normal file
13
app_vue/node_modules/@soda/get-current-script/fixtures/test.html
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="../index.js"></script>
|
||||
<script src="./log-src.js"></script>
|
||||
</body>
|
||||
</html>
|
79
app_vue/node_modules/@soda/get-current-script/index.js
generated
vendored
Normal file
79
app_vue/node_modules/@soda/get-current-script/index.js
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
// addapted from the document.currentScript polyfill by Adam Miller
|
||||
// MIT license
|
||||
// source: https://github.com/amiller-gh/currentScript-polyfill
|
||||
|
||||
// added support for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1620505
|
||||
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define([], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory();
|
||||
} else {
|
||||
root.getCurrentScript = factory();
|
||||
}
|
||||
}(typeof self !== 'undefined' ? self : this, function () {
|
||||
function getCurrentScript () {
|
||||
var descriptor = Object.getOwnPropertyDescriptor(document, 'currentScript')
|
||||
// for chrome
|
||||
if (!descriptor && 'currentScript' in document && document.currentScript) {
|
||||
return document.currentScript
|
||||
}
|
||||
|
||||
// for other browsers with native support for currentScript
|
||||
if (descriptor && descriptor.get !== getCurrentScript && document.currentScript) {
|
||||
return document.currentScript
|
||||
}
|
||||
|
||||
// IE 8-10 support script readyState
|
||||
// IE 11+ & Firefox support stack trace
|
||||
try {
|
||||
throw new Error();
|
||||
}
|
||||
catch (err) {
|
||||
// Find the second match for the "at" string to get file src url from stack.
|
||||
var ieStackRegExp = /.*at [^(]*\((.*):(.+):(.+)\)$/ig,
|
||||
ffStackRegExp = /@([^@]*):(\d+):(\d+)\s*$/ig,
|
||||
stackDetails = ieStackRegExp.exec(err.stack) || ffStackRegExp.exec(err.stack),
|
||||
scriptLocation = (stackDetails && stackDetails[1]) || false,
|
||||
line = (stackDetails && stackDetails[2]) || false,
|
||||
currentLocation = document.location.href.replace(document.location.hash, ''),
|
||||
pageSource,
|
||||
inlineScriptSourceRegExp,
|
||||
inlineScriptSource,
|
||||
scripts = document.getElementsByTagName('script'); // Live NodeList collection
|
||||
|
||||
if (scriptLocation === currentLocation) {
|
||||
pageSource = document.documentElement.outerHTML;
|
||||
inlineScriptSourceRegExp = new RegExp('(?:[^\\n]+?\\n){0,' + (line - 2) + '}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*', 'i');
|
||||
inlineScriptSource = pageSource.replace(inlineScriptSourceRegExp, '$1').trim();
|
||||
}
|
||||
|
||||
for (var i = 0; i < scripts.length; i++) {
|
||||
// If ready state is interactive, return the script tag
|
||||
if (scripts[i].readyState === 'interactive') {
|
||||
return scripts[i];
|
||||
}
|
||||
|
||||
// If src matches, return the script tag
|
||||
if (scripts[i].src === scriptLocation) {
|
||||
return scripts[i];
|
||||
}
|
||||
|
||||
// If inline source matches, return the script tag
|
||||
if (
|
||||
scriptLocation === currentLocation &&
|
||||
scripts[i].innerHTML &&
|
||||
scripts[i].innerHTML.trim() === inlineScriptSource
|
||||
) {
|
||||
return scripts[i];
|
||||
}
|
||||
}
|
||||
|
||||
// If no match, return null
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
return getCurrentScript
|
||||
}));
|
179
app_vue/node_modules/@soda/get-current-script/nightwatch.conf.js
generated
vendored
Normal file
179
app_vue/node_modules/@soda/get-current-script/nightwatch.conf.js
generated
vendored
Normal file
@ -0,0 +1,179 @@
|
||||
// Autogenerated by Nightwatch
|
||||
// Refer to the online docs for more details: https://nightwatchjs.org/gettingstarted/configuration/
|
||||
const Services = {}; loadServices();
|
||||
|
||||
module.exports = {
|
||||
// An array of folders (excluding subfolders) where your tests are located;
|
||||
// if this is not specified, the test source must be passed as the second argument to the test runner.
|
||||
src_folders: [],
|
||||
|
||||
// See https://nightwatchjs.org/guide/working-with-page-objects/
|
||||
page_objects_path: '',
|
||||
|
||||
// See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-commands
|
||||
custom_commands_path: '',
|
||||
|
||||
// See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-assertions
|
||||
custom_assertions_path: '',
|
||||
|
||||
// See https://nightwatchjs.org/guide/#external-globals
|
||||
globals_path : '',
|
||||
|
||||
webdriver: {},
|
||||
|
||||
test_settings: {
|
||||
default: {
|
||||
disable_error_log: false,
|
||||
launch_url: 'http://localhost:5000',
|
||||
|
||||
screenshots: {
|
||||
enabled: false,
|
||||
path: 'screens',
|
||||
on_failure: true
|
||||
},
|
||||
|
||||
desiredCapabilities: {
|
||||
browserName : 'firefox'
|
||||
},
|
||||
|
||||
webdriver: {
|
||||
start_process: true,
|
||||
server_path: (Services.geckodriver ? Services.geckodriver.path : '')
|
||||
}
|
||||
},
|
||||
|
||||
safari: {
|
||||
desiredCapabilities : {
|
||||
browserName : 'safari',
|
||||
alwaysMatch: {
|
||||
acceptInsecureCerts: false
|
||||
}
|
||||
},
|
||||
webdriver: {
|
||||
port: 4445,
|
||||
start_process: true,
|
||||
server_path: '/usr/bin/safaridriver'
|
||||
}
|
||||
},
|
||||
|
||||
firefox: {
|
||||
desiredCapabilities : {
|
||||
browserName : 'firefox',
|
||||
alwaysMatch: {
|
||||
// Enable this if you encounter unexpected SSL certificate errors in Firefox
|
||||
// acceptInsecureCerts: true,
|
||||
'moz:firefoxOptions': {
|
||||
args: [
|
||||
// '-headless',
|
||||
// '-verbose'
|
||||
],
|
||||
}
|
||||
}
|
||||
},
|
||||
webdriver: {
|
||||
start_process: true,
|
||||
port: 5555,
|
||||
server_path: (Services.geckodriver ? Services.geckodriver.path : ''),
|
||||
cli_args: [
|
||||
// very verbose geckodriver logs
|
||||
// '-vv'
|
||||
'--port',
|
||||
'5555'
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
chrome: {
|
||||
desiredCapabilities : {
|
||||
browserName : 'chrome',
|
||||
chromeOptions : {
|
||||
// This tells Chromedriver to run using the legacy JSONWire protocol (not required in Chrome 78)
|
||||
// w3c: false,
|
||||
// More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/
|
||||
args: [
|
||||
//'--no-sandbox',
|
||||
//'--ignore-certificate-errors',
|
||||
//'--allow-insecure-localhost',
|
||||
//'--headless'
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
webdriver: {
|
||||
start_process: true,
|
||||
port: 9515,
|
||||
server_path: (Services.chromedriver ? Services.chromedriver.path : ''),
|
||||
cli_args: [
|
||||
// --verbose
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// Configuration for when using the Selenium service, either locally or remote, |
|
||||
// like Selenium Grid |
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
selenium: {
|
||||
// Selenium Server is running locally and is managed by Nightwatch
|
||||
selenium: {
|
||||
start_process: true,
|
||||
port: 4444,
|
||||
server_path: (Services.seleniumServer ? Services.seleniumServer.path : ''),
|
||||
cli_args: {
|
||||
'webdriver.gecko.driver': (Services.geckodriver ? Services.geckodriver.path : ''),
|
||||
'webdriver.chrome.driver': (Services.chromedriver ? Services.chromedriver.path : ''),
|
||||
'webdriver.ie.driver': (Services.iedriver ? Services.iedriver.path : '')
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
'selenium.chrome': {
|
||||
extends: 'selenium',
|
||||
desiredCapabilities: {
|
||||
browserName: 'chrome',
|
||||
chromeOptions : {
|
||||
w3c: false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
'selenium.firefox': {
|
||||
extends: 'selenium',
|
||||
desiredCapabilities: {
|
||||
browserName: 'firefox',
|
||||
'moz:firefoxOptions': {
|
||||
args: [
|
||||
// '-headless',
|
||||
// '-verbose'
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
'ie': {
|
||||
extends: 'selenium',
|
||||
desiredCapabilities: {
|
||||
browserName: 'internet explorer'
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
function loadServices() {
|
||||
try {
|
||||
Services.seleniumServer = require('selenium-server');
|
||||
} catch (err) {}
|
||||
|
||||
try {
|
||||
Services.chromedriver = require('chromedriver');
|
||||
} catch (err) {}
|
||||
|
||||
try {
|
||||
Services.geckodriver = require('geckodriver');
|
||||
} catch (err) {}
|
||||
|
||||
try {
|
||||
Services.iedriver = require('iedriver');
|
||||
} catch (err) {}
|
||||
}
|
35
app_vue/node_modules/@soda/get-current-script/package.json
generated
vendored
Normal file
35
app_vue/node_modules/@soda/get-current-script/package.json
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "@soda/get-current-script",
|
||||
"version": "1.0.2",
|
||||
"description": "get the current executing script, with polyfills for IE9+ and Firefox",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "serve .",
|
||||
"test:chrome": "nightwatch -t test.js -e chrome",
|
||||
"test:firefox": "nightwatch -t test.js -e firefox",
|
||||
"test:ie": "nightwatch -t test.js -e ie",
|
||||
"ci:chrome": "yarn start-test start http://localhost:5000 test:chrome",
|
||||
"ci:firefox": "yarn start-test start http://localhost:5000 test:firefox",
|
||||
"ci:ie": "yarn start-test start http://localhost:5000 test:ie",
|
||||
"ci": "yarn ci:chrome && yarn ci:firefox && yarn ci:ie"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sodatea/get-current-script.git"
|
||||
},
|
||||
"author": "Haoqun Jiang",
|
||||
"license": "MIT",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"chromedriver": "^83.0.0",
|
||||
"geckodriver": "^1.19.1",
|
||||
"iedriver": "^3.14.1",
|
||||
"nightwatch": "^1.3.4",
|
||||
"selenium-server": "^3.141.59",
|
||||
"serve": "^11.3.1",
|
||||
"start-server-and-test": "^1.10.8"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
29
app_vue/node_modules/@soda/get-current-script/test.js
generated
vendored
Normal file
29
app_vue/node_modules/@soda/get-current-script/test.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
module.exports = {
|
||||
'getCurrentScript': function (browser) {
|
||||
browser
|
||||
.url(`${browser.launch_url}/fixtures/test.html`)
|
||||
.assert.containsText(
|
||||
'#app',
|
||||
`${browser.launch_url}/fixtures/log-src.js`
|
||||
)
|
||||
.end()
|
||||
},
|
||||
'getCurrentScript in microtask': function (browser) {
|
||||
browser
|
||||
.url(`${browser.launch_url}/fixtures/test-microtask.html`)
|
||||
.assert.containsText(
|
||||
'#app',
|
||||
`${browser.launch_url}/fixtures/log-src-in-microtask.js`
|
||||
)
|
||||
.end()
|
||||
},
|
||||
'use it as a polyfill': function (browser) {
|
||||
browser
|
||||
.url(`${browser.launch_url}/fixtures/test-polyfill.html`)
|
||||
.assert.containsText(
|
||||
'#app',
|
||||
'It works!'
|
||||
)
|
||||
.end()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user