Add yet-another-react-lightbox package and update .gitignore to exclude node_modules

This commit is contained in:
IGNY8 VPS (Salman)
2025-11-12 18:50:30 +00:00
parent bd2a5570a9
commit c92f4a5edd
9304 changed files with 29 additions and 2008667 deletions

View File

@@ -1,88 +0,0 @@
// Karma configuration
const karmaCommon = require('./karma.conf.common.cjs')
let chromeBin = 'ChromeHeadless'
if (process.platform === 'linux') {
// We need to choose either Chrome or Chromium.
// Canary is not available on linux.
// If we do not find Chromium then we can deduce that
// either Chrome is installed or there is no Chrome variant at all,
// in which case karma-chrome-launcher will output an error.
// If `which` finds nothing it will throw an error.
const { execSync } = require('child_process')
try {
if (execSync('which chromium-browser')) chromeBin = 'ChromiumHeadless'
} catch (e) {}
}
module.exports = function (config) {
config.set(
Object.assign(karmaCommon(config), {
files: [
'spec/RAFPlugin.js',
{
pattern: 'spec/fixtures/fixture.css',
included: false,
served: true
},
{
pattern: 'spec/fixtures/pixel.png',
included: false,
served: true
},
{
pattern: 'src/**/*.js',
included: false,
served: true,
type: 'modules'
},
{
pattern: 'spec/helpers.js',
included: false,
served: true,
type: 'module'
},
{
pattern: 'spec/setupBrowser.js',
included: true,
type: 'module'
},
{
pattern: 'spec/spec/*/**/*.js',
included: true,
type: 'module'
}
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'src/**/*.js': ['coverage']
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'coverage'],
coverageReporter: {
// Specify a reporter type.
type: 'lcov',
dir: 'coverage/',
subdir: function (browser) {
// normalization process to keep a consistent browser name accross different OS
return browser.toLowerCase().split(/[ /-]/)[0] // output the results into: './coverage/firefox/'
},
instrumenterOptions: {
istanbul: {
esModules: true
}
}
},
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [chromeBin, 'FirefoxHeadless']
})
)
}

View File

@@ -1,67 +0,0 @@
// Karma shared configuration
const os = require('os')
const cpuCount = os.cpus().length
module.exports = function (config) {
return {
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '../',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'.config/pretest.js',
'spec/RAFPlugin.js',
{
pattern: 'spec/fixtures/fixture.css',
included: false,
served: true
},
{
pattern: 'spec/fixtures/fixture.svg',
included: false,
served: true
},
{
pattern: 'spec/fixtures/pixel.png',
included: false,
served: true
},
'dist/svg.js',
'spec/spec/*.js'
],
proxies: {
'/fixtures/': '/base/spec/fixtures/',
'/spec/': '/base/spec/'
},
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
// Concurrency level
// how many browser should be started simultaneous
concurrency: cpuCount || Infinity,
// list of files to exclude
exclude: []
}
}

View File

@@ -1,144 +0,0 @@
// Karma configuration
// https://wiki.saucelabs.com/display/DOCS/Platform+Configurator
// TODO: remove dotenv after local test
// require('dotenv').config()
const karmaCommon = require('./karma.conf.common.cjs')
const SauceLabsLaunchers = {
/** Real mobile devices are not available
* Your account does not have access to Android devices.
* Please contact sales@saucelabs.com to add this feature to your account. */
/* sl_android_chrome: {
base: 'SauceLabs',
appiumVersion: '1.5.3',
deviceName: 'Samsung Galaxy S7 Device',
deviceOrientation: 'portrait',
browserName: 'Chrome',
platformVersion: '6.0',
platformName: 'Android'
}, */
/* sl_android: {
base: 'SauceLabs',
browserName: 'Android',
deviceName: 'Android Emulator',
deviceOrientation: 'portrait'
}, */
SL_firefox_latest: {
base: 'SauceLabs',
browserName: 'firefox',
version: 'latest'
},
SL_chrome_latest: {
base: 'SauceLabs',
browserName: 'chrome',
version: 'latest'
},
SL_InternetExplorer: {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '11.0'
} /*
sl_windows_edge: {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
version: 'latest',
platform: 'Windows 10'
},
sl_macos_safari: {
base: 'SauceLabs',
browserName: 'safari',
platform: 'macOS 10.13',
version: '12.0',
recordVideo: true,
recordScreenshots: true,
screenResolution: '1024x768'
} */ /*,
sl_macos_iphone: {
base: 'SauceLabs',
browserName: 'Safari',
deviceName: 'iPhone SE Simulator',
deviceOrientation: 'portrait',
platformVersion: '10.2',
platformName: 'iOS'
}
'SL_Chrome': {
base: 'SauceLabs',
browserName: 'chrome',
version: '48.0',
platform: 'Linux'
},
'SL_Firefox': {
base: 'SauceLabs',
browserName: 'firefox',
version: '50.0',
platform: 'Windows 10'
},
'SL_Safari': {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.11',
version: '10.0'
} */
}
module.exports = function (config) {
if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
console.error(
'SAUCE_USERNAME and SAUCE_ACCESS_KEY must be provided as environment variables.'
)
console.warn('Aborting Sauce Labs test')
process.exit(1)
}
const settings = Object.assign(karmaCommon(config), {
// Concurrency level
// how many browser should be started simultaneous
// Saucelabs allow up to 5 concurrent sessions on the free open source tier.
concurrency: 5,
// this specifies which plugins karma should load
// by default all karma plugins, starting with `karma-` will load
// so if you are really puzzled why something isn't working, then comment
// out plugins: [] - it's here to make karma load faster
// get possible karma plugins by `ls node_modules | grep 'karma-*'`
plugins: ['karma-jasmine', 'karma-sauce-launcher'],
// logLevel: config.LOG_DEBUG,
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['dots', 'saucelabs'],
customLaunchers: SauceLabsLaunchers,
// start these browsers
browsers: Object.keys(SauceLabsLaunchers),
sauceLabs: {
testName: 'SVG.js Unit Tests'
// connectOptions: {
// noSslBumpDomains: "all"
// },
// connectOptions: {
// port: 5757,
// logfile: 'sauce_connect.log'
// },
}
// The number of disconnections tolerated.
// browserDisconnectTolerance: 0, // well, sometimes it helps to just restart
// // How long does Karma wait for a browser to reconnect (in ms).
// browserDisconnectTimeout: 10 * 60 * 1000,
// // How long will Karma wait for a message from a browser before disconnecting from it (in ms). ~ macOS 10.12 needs more than 7 minutes
// browserNoActivityTimeout: 20 * 60 * 1000,
// // Timeout for capturing a browser (in ms). On newer versions of iOS simulator (10.0+), the start up time could be between 3 - 6 minutes.
// captureTimeout: 12 * 60 * 1000, // this is useful if saucelabs takes a long time to boot a vm
// // Required to make Safari on Sauce Labs play nice.
// // hostname: 'karmalocal.dev'
})
console.log(settings)
config.set(settings)
}

View File

@@ -1,33 +0,0 @@
/* global SVGElement */
/* eslint no-new-object: "off" */
import CustomEventPolyfill from '@target/custom-event-polyfill/src/index.js6'
import children from '../src/polyfills/children.js'
/* IE 11 has no innerHTML on SVGElement */
import '../src/polyfills/innerHTML.js'
/* IE 11 has no correct CustomEvent implementation */
CustomEventPolyfill()
/* IE 11 has no children on SVGElement */
try {
if (!SVGElement.prototype.children) {
Object.defineProperty(SVGElement.prototype, 'children', {
get: function () {
return children(this)
}
})
}
} catch (e) {}
/* IE 11 cannot handle getPrototypeOf(not_obj) */
try {
delete Object.getPrototypeOf('test')
} catch (e) {
var old = Object.getPrototypeOf
Object.getPrototypeOf = function (o) {
if (typeof o !== 'object') o = new Object(o)
return old.call(this, o)
}
}

View File

@@ -1,22 +0,0 @@
/* global XMLHttpRequest */
'use strict'
function get(uri) {
var xhr = new XMLHttpRequest()
xhr.open('GET', uri, false)
xhr.send()
if (xhr.status !== 200) {
console.error('SVG.js fixture could not be loaded. Tests will fail.')
}
return xhr.responseText
}
function main() {
var style = document.createElement('style')
document.head.appendChild(style)
style.sheet.insertRule(get('/fixtures/fixture.css'), 0)
document.body.innerHTML = get('/fixtures/fixture.svg')
}
main()

View File

@@ -1,144 +0,0 @@
import pkg from '../package.json' with { type: 'json' }
import babel from '@rollup/plugin-babel'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import filesize from 'rollup-plugin-filesize'
import terser from '@rollup/plugin-terser'
const buildDate = Date()
const headerLong = `/*!
* ${pkg.name} - ${pkg.description}
* @version ${pkg.version}
* ${pkg.homepage}
*
* @copyright ${pkg.author}
* @license ${pkg.license}
*
* BUILT: ${buildDate}
*/;`
const headerShort = `/*! ${pkg.name} v${pkg.version} ${pkg.license}*/;`
const getBabelConfig = (node = false) => {
let targets = pkg.browserslist
const plugins = [
[
'@babel/transform-runtime',
{
version: '^7.24.7',
regenerator: false,
useESModules: true
}
],
[
'polyfill-corejs3',
{
method: 'usage-pure'
}
]
]
if (node) {
targets = 'maintained node versions'
}
return babel({
include: 'src/**',
babelHelpers: 'runtime',
babelrc: false,
targets: targets,
presets: [
[
'@babel/preset-env',
{
modules: false,
// useBuildins and plugin-transform-runtime are mutually exclusive
// https://github.com/babel/babel/issues/10271#issuecomment-528379505
// use babel-polyfills when released
useBuiltIns: false,
bugfixes: true,
loose: true
}
]
],
plugins
})
}
// When few of these get mangled nothing works anymore
// We loose literally nothing by let these unmangled
const classes = [
'A',
'ClipPath',
'Defs',
'Element',
'G',
'Image',
'Marker',
'Path',
'Polygon',
'Rect',
'Stop',
'Svg',
'Text',
'Tspan',
'Circle',
'Container',
'Dom',
'Ellipse',
'Gradient',
'Line',
'Mask',
'Pattern',
'Polyline',
'Shape',
'Style',
'Symbol',
'TextPath',
'Use'
]
const config = (node, min, esm = false) => ({
input: node || esm ? './src/main.js' : './src/svg.js',
output: {
file: esm
? './dist/svg.esm.js'
: node
? './dist/svg.node.cjs'
: min
? './dist/svg.min.js'
: './dist/svg.js',
format: esm ? 'esm' : node ? 'cjs' : 'iife',
name: 'SVG',
sourcemap: true,
banner: headerLong,
// remove Object.freeze
freeze: false
},
treeshake: {
// property getter have no sideeffects
propertyReadSideEffects: false
},
plugins: [
resolve({ browser: !node }),
commonjs(),
getBabelConfig(node),
filesize(),
!min
? {}
: terser({
mangle: {
reserved: classes
},
output: {
preamble: headerShort
}
})
]
})
// [node, minified, esm]
const modes = [[false], [false, true], [true], [false, false, true]]
export default modes.map((m) => config(...m))

View File

@@ -1,20 +0,0 @@
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import filesize from 'rollup-plugin-filesize'
// We dont need babel. All polyfills are compatible
const config = (ie) => ({
input: './.config/polyfillListIE.js',
output: {
file: 'dist/polyfillsIE.js',
format: 'iife'
},
plugins: [
resolve({ browser: true }),
commonjs(),
//terser(),
filesize()
]
})
export default [true].map(config)

View File

@@ -1,55 +0,0 @@
import * as pkg from '../package.json'
import babel from '@rollup/plugin-babel'
import multiEntry from '@rollup/plugin-multi-entry'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
const getBabelConfig = (targets) =>
babel({
include: ['src/**', 'spec/**/*'],
babelHelpers: 'runtime',
babelrc: false,
presets: [
[
'@babel/preset-env',
{
modules: false,
targets: targets || pkg.browserslist,
// useBuildins and plugin-transform-runtime are mutually exclusive
// https://github.com/babel/babel/issues/10271#issuecomment-528379505
// use babel-polyfills when released
useBuiltIns: false,
// corejs: 3,
bugfixes: true
}
]
],
plugins: [
[
'@babel/plugin-transform-runtime',
{
corejs: 3,
helpers: true,
useESModules: true,
version: '^7.9.6',
regenerator: false
}
]
]
})
export default {
input: ['spec/setupBrowser.js', 'spec/spec/*/*.js'],
output: {
file: 'spec/es5TestBundle.js',
name: 'SVGTests',
format: 'iife'
},
plugins: [
resolve({ browser: true }),
commonjs(),
getBabelConfig(),
multiEntry()
],
external: ['@babel/runtime', '@babel/runtime-corejs3']
}