.
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
export {};
|
||||
+220
@@ -0,0 +1,220 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
||||
const _stringifyrequest = require("../../stringify-request");
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
const loaderApi = ()=>{};
|
||||
loaderApi.pitch = function loader(request) {
|
||||
const loaderSpan = this.currentTraceSpan.traceChild('next-style-loader');
|
||||
return loaderSpan.traceFn(()=>{
|
||||
const options = this.getOptions();
|
||||
const insert = typeof options.insert === 'undefined' ? '"head"' : typeof options.insert === 'string' ? JSON.stringify(options.insert) : options.insert.toString();
|
||||
const injectType = options.injectType || 'styleTag';
|
||||
const esModule = typeof options.esModule !== 'undefined' ? options.esModule : false;
|
||||
delete options.esModule;
|
||||
switch(injectType){
|
||||
case 'linkTag':
|
||||
{
|
||||
const hmrCode = this.hot ? `
|
||||
if (module.hot) {
|
||||
module.hot.accept(
|
||||
${(0, _stringifyrequest.stringifyRequest)(this, `!!${request}`)},
|
||||
function() {
|
||||
${esModule ? 'update(content);' : `content = require(${(0, _stringifyrequest.stringifyRequest)(this, `!!${request}`)});
|
||||
|
||||
content = content.__esModule ? content.default : content;
|
||||
|
||||
update(content);`}
|
||||
}
|
||||
);
|
||||
|
||||
module.hot.dispose(function() {
|
||||
update();
|
||||
});
|
||||
}` : '';
|
||||
return `${esModule ? `import api from ${(0, _stringifyrequest.stringifyRequest)(this, `!${_path.default.join(__dirname, 'runtime/injectStylesIntoLinkTag.js')}`)};
|
||||
import content from ${(0, _stringifyrequest.stringifyRequest)(this, `!!${request}`)};` : `var api = require(${(0, _stringifyrequest.stringifyRequest)(this, `!${_path.default.join(__dirname, 'runtime/injectStylesIntoLinkTag.js')}`)});
|
||||
var content = require(${(0, _stringifyrequest.stringifyRequest)(this, `!!${request}`)});
|
||||
|
||||
content = content.__esModule ? content.default : content;`}
|
||||
|
||||
var options = ${JSON.stringify(options)};
|
||||
|
||||
options.insert = ${insert};
|
||||
|
||||
var update = api(content, options);
|
||||
|
||||
${hmrCode}
|
||||
|
||||
${esModule ? 'export default {}' : ''}`;
|
||||
}
|
||||
case 'lazyStyleTag':
|
||||
case 'lazySingletonStyleTag':
|
||||
{
|
||||
const isSingleton = injectType === 'lazySingletonStyleTag';
|
||||
const hmrCode = this.hot ? `
|
||||
if (module.hot) {
|
||||
if (!content.locals || module.hot.invalidate) {
|
||||
|
||||
var isEqualLocals = ${// eslint-disable-next-line @next/internal/typechecked-require -- Not a module.
|
||||
require('./runtime/isEqualLocals').toString()};
|
||||
console.log({isEqualLocals})
|
||||
var oldLocals = content.locals;
|
||||
|
||||
module.hot.accept(
|
||||
${(0, _stringifyrequest.stringifyRequest)(this, `!!${request}`)},
|
||||
function () {
|
||||
${esModule ? `if (!isEqualLocals(oldLocals, content.locals)) {
|
||||
module.hot.invalidate();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
oldLocals = content.locals;
|
||||
|
||||
if (update && refs > 0) {
|
||||
update(content);
|
||||
}` : `content = require(${(0, _stringifyrequest.stringifyRequest)(this, `!!${request}`)});
|
||||
|
||||
content = content.__esModule ? content.default : content;
|
||||
|
||||
if (!isEqualLocals(oldLocals, content.locals)) {
|
||||
module.hot.invalidate();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
oldLocals = content.locals;
|
||||
|
||||
if (update && refs > 0) {
|
||||
update(content);
|
||||
}`}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
module.hot.dispose(function() {
|
||||
if (update) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
}` : '';
|
||||
return `${esModule ? `import api from ${(0, _stringifyrequest.stringifyRequest)(this, `!${_path.default.join(__dirname, 'runtime/injectStylesIntoStyleTag.js')}`)};
|
||||
import content from ${(0, _stringifyrequest.stringifyRequest)(this, `!!${request}`)};` : `var api = require(${(0, _stringifyrequest.stringifyRequest)(this, `!${_path.default.join(__dirname, 'runtime/injectStylesIntoStyleTag.js')}`)});
|
||||
var content = require(${(0, _stringifyrequest.stringifyRequest)(this, `!!${request}`)});
|
||||
|
||||
content = content.__esModule ? content.default : content;
|
||||
|
||||
if (typeof content === 'string') {
|
||||
content = [[module.id, content, '']];
|
||||
}`}
|
||||
|
||||
var refs = 0;
|
||||
var update;
|
||||
var options = ${JSON.stringify(options)};
|
||||
|
||||
options.insert = ${insert};
|
||||
options.singleton = ${isSingleton};
|
||||
|
||||
var exported = {};
|
||||
|
||||
exported.locals = content.locals || {};
|
||||
exported.use = function() {
|
||||
if (!(refs++)) {
|
||||
update = api(content, options);
|
||||
}
|
||||
|
||||
return exported;
|
||||
};
|
||||
exported.unuse = function() {
|
||||
if (refs > 0 && !--refs) {
|
||||
update();
|
||||
update = null;
|
||||
}
|
||||
};
|
||||
|
||||
${hmrCode}
|
||||
|
||||
${esModule ? 'export default' : 'module.exports ='} exported;`;
|
||||
}
|
||||
case 'styleTag':
|
||||
case 'singletonStyleTag':
|
||||
default:
|
||||
{
|
||||
const isSingleton = injectType === 'singletonStyleTag';
|
||||
const hmrCode = this.hot ? `
|
||||
if (module.hot) {
|
||||
if (!content.locals || module.hot.invalidate) {
|
||||
var isEqualLocals = ${// eslint-disable-next-line @next/internal/typechecked-require -- Not a module.
|
||||
require('./runtime/isEqualLocals').toString()};
|
||||
var oldLocals = content.locals;
|
||||
|
||||
module.hot.accept(
|
||||
${(0, _stringifyrequest.stringifyRequest)(this, `!!${request}`)},
|
||||
function () {
|
||||
${esModule ? `if (!isEqualLocals(oldLocals, content.locals)) {
|
||||
module.hot.invalidate();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
oldLocals = content.locals;
|
||||
|
||||
update(content);` : `content = require(${(0, _stringifyrequest.stringifyRequest)(this, `!!${request}`)});
|
||||
|
||||
content = content.__esModule ? content.default : content;
|
||||
|
||||
if (typeof content === 'string') {
|
||||
content = [[module.id, content, '']];
|
||||
}
|
||||
|
||||
if (!isEqualLocals(oldLocals, content.locals)) {
|
||||
module.hot.invalidate();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
oldLocals = content.locals;
|
||||
|
||||
update(content);`}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
module.hot.dispose(function() {
|
||||
update();
|
||||
});
|
||||
}` : '';
|
||||
return `${esModule ? `import api from ${(0, _stringifyrequest.stringifyRequest)(this, `!${_path.default.join(__dirname, 'runtime/injectStylesIntoStyleTag.js')}`)};
|
||||
import content from ${(0, _stringifyrequest.stringifyRequest)(this, `!!${request}`)};` : `var api = require(${(0, _stringifyrequest.stringifyRequest)(this, `!${_path.default.join(__dirname, 'runtime/injectStylesIntoStyleTag.js')}`)});
|
||||
var content = require(${(0, _stringifyrequest.stringifyRequest)(this, `!!${request}`)});
|
||||
|
||||
content = content.__esModule ? content.default : content;
|
||||
|
||||
if (typeof content === 'string') {
|
||||
content = [[module.id, content, '']];
|
||||
}`}
|
||||
|
||||
var options = ${JSON.stringify(options)};
|
||||
|
||||
options.insert = ${insert};
|
||||
options.singleton = ${isSingleton};
|
||||
|
||||
var update = api(content, options);
|
||||
|
||||
${hmrCode}
|
||||
|
||||
${esModule ? 'export default' : 'module.exports ='} content.locals || {};`;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
module.exports = loaderApi;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
declare const getTarget: (target: any) => any;
|
||||
Generated
Vendored
+61
@@ -0,0 +1,61 @@
|
||||
/// <reference types="webpack/module.d.ts" />
|
||||
"use strict";
|
||||
const getTarget = (()=>{
|
||||
const memo = {};
|
||||
return function memorize(target) {
|
||||
if (typeof memo[target] === 'undefined') {
|
||||
let styleTarget = document.querySelector(target);
|
||||
// Special case to return head of iframe instead of iframe itself
|
||||
if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
|
||||
try {
|
||||
// This will throw an exception if access to iframe is blocked
|
||||
// due to cross-origin restrictions
|
||||
styleTarget = styleTarget.contentDocument.head;
|
||||
} catch (e) {
|
||||
// istanbul ignore next
|
||||
styleTarget = null;
|
||||
}
|
||||
}
|
||||
memo[target] = styleTarget;
|
||||
}
|
||||
return memo[target];
|
||||
};
|
||||
})();
|
||||
module.exports = (url, options)=>{
|
||||
options = options || {};
|
||||
options.attributes = typeof options.attributes === 'object' ? options.attributes : {};
|
||||
if (typeof options.attributes.nonce === 'undefined') {
|
||||
const nonce = typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;
|
||||
if (nonce) {
|
||||
options.attributes.nonce = nonce;
|
||||
}
|
||||
}
|
||||
const link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = url;
|
||||
Object.keys(options.attributes).forEach((key)=>{
|
||||
link.setAttribute(key, options.attributes[key]);
|
||||
});
|
||||
if (typeof options.insert === 'function') {
|
||||
options.insert(link);
|
||||
} else {
|
||||
const target = getTarget(options.insert || 'head');
|
||||
if (!target) {
|
||||
throw Object.defineProperty(new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."), "__NEXT_ERROR_CODE", {
|
||||
value: "E245",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
target.appendChild(link);
|
||||
}
|
||||
return (newUrl)=>{
|
||||
if (typeof newUrl === 'string') {
|
||||
link.href = newUrl;
|
||||
} else {
|
||||
link.parentNode.removeChild(link);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
//# sourceMappingURL=injectStylesIntoLinkTag.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/build/webpack/loaders/next-style-loader/runtime/injectStylesIntoLinkTag.ts"],"sourcesContent":["/// <reference types=\"webpack/module.d.ts\" />\n\nconst getTarget = (() => {\n const memo: any = {}\n\n return function memorize(target: any) {\n if (typeof memo[target] === 'undefined') {\n let styleTarget = document.querySelector(target)\n\n // Special case to return head of iframe instead of iframe itself\n if (\n window.HTMLIFrameElement &&\n styleTarget instanceof window.HTMLIFrameElement\n ) {\n try {\n // This will throw an exception if access to iframe is blocked\n // due to cross-origin restrictions\n styleTarget = (styleTarget as any).contentDocument.head\n } catch (e) {\n // istanbul ignore next\n styleTarget = null\n }\n }\n\n memo[target] = styleTarget\n }\n\n return memo[target]\n }\n})()\n\nmodule.exports = (url: any, options: any) => {\n options = options || {}\n options.attributes =\n typeof options.attributes === 'object' ? options.attributes : {}\n\n if (typeof options.attributes.nonce === 'undefined') {\n const nonce =\n typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null\n\n if (nonce) {\n options.attributes.nonce = nonce\n }\n }\n\n const link = document.createElement('link')\n\n link.rel = 'stylesheet'\n link.href = url\n\n Object.keys(options.attributes).forEach((key) => {\n link.setAttribute(key, options.attributes[key])\n })\n\n if (typeof options.insert === 'function') {\n options.insert(link)\n } else {\n const target = getTarget(options.insert || 'head')\n\n if (!target) {\n throw new Error(\n \"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\"\n )\n }\n\n target.appendChild(link)\n }\n\n return (newUrl: any) => {\n if (typeof newUrl === 'string') {\n link.href = newUrl\n } else {\n link.parentNode!.removeChild(link)\n }\n }\n}\n"],"names":["getTarget","memo","memorize","target","styleTarget","document","querySelector","window","HTMLIFrameElement","contentDocument","head","e","module","exports","url","options","attributes","nonce","__webpack_nonce__","link","createElement","rel","href","Object","keys","forEach","key","setAttribute","insert","Error","appendChild","newUrl","parentNode","removeChild"],"mappings":"AAAA,6CAA6C;;AAE7C,MAAMA,YAAY,AAAC,CAAA;IACjB,MAAMC,OAAY,CAAC;IAEnB,OAAO,SAASC,SAASC,MAAW;QAClC,IAAI,OAAOF,IAAI,CAACE,OAAO,KAAK,aAAa;YACvC,IAAIC,cAAcC,SAASC,aAAa,CAACH;YAEzC,iEAAiE;YACjE,IACEI,OAAOC,iBAAiB,IACxBJ,uBAAuBG,OAAOC,iBAAiB,EAC/C;gBACA,IAAI;oBACF,8DAA8D;oBAC9D,mCAAmC;oBACnCJ,cAAc,AAACA,YAAoBK,eAAe,CAACC,IAAI;gBACzD,EAAE,OAAOC,GAAG;oBACV,uBAAuB;oBACvBP,cAAc;gBAChB;YACF;YAEAH,IAAI,CAACE,OAAO,GAAGC;QACjB;QAEA,OAAOH,IAAI,CAACE,OAAO;IACrB;AACF,CAAA;AAEAS,OAAOC,OAAO,GAAG,CAACC,KAAUC;IAC1BA,UAAUA,WAAW,CAAC;IACtBA,QAAQC,UAAU,GAChB,OAAOD,QAAQC,UAAU,KAAK,WAAWD,QAAQC,UAAU,GAAG,CAAC;IAEjE,IAAI,OAAOD,QAAQC,UAAU,CAACC,KAAK,KAAK,aAAa;QACnD,MAAMA,QACJ,OAAOC,sBAAsB,cAAcA,oBAAoB;QAEjE,IAAID,OAAO;YACTF,QAAQC,UAAU,CAACC,KAAK,GAAGA;QAC7B;IACF;IAEA,MAAME,OAAOd,SAASe,aAAa,CAAC;IAEpCD,KAAKE,GAAG,GAAG;IACXF,KAAKG,IAAI,GAAGR;IAEZS,OAAOC,IAAI,CAACT,QAAQC,UAAU,EAAES,OAAO,CAAC,CAACC;QACvCP,KAAKQ,YAAY,CAACD,KAAKX,QAAQC,UAAU,CAACU,IAAI;IAChD;IAEA,IAAI,OAAOX,QAAQa,MAAM,KAAK,YAAY;QACxCb,QAAQa,MAAM,CAACT;IACjB,OAAO;QACL,MAAMhB,SAASH,UAAUe,QAAQa,MAAM,IAAI;QAE3C,IAAI,CAACzB,QAAQ;YACX,MAAM,qBAEL,CAFK,IAAI0B,MACR,4GADI,qBAAA;uBAAA;4BAAA;8BAAA;YAEN;QACF;QAEA1B,OAAO2B,WAAW,CAACX;IACrB;IAEA,OAAO,CAACY;QACN,IAAI,OAAOA,WAAW,UAAU;YAC9BZ,KAAKG,IAAI,GAAGS;QACd,OAAO;YACLZ,KAAKa,UAAU,CAAEC,WAAW,CAACd;QAC/B;IACF;AACF","ignoreList":[0]}
|
||||
node_modules/next/dist/build/webpack/loaders/next-style-loader/runtime/injectStylesIntoStyleTag.d.ts
Generated
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
declare const isOldIE: () => any;
|
||||
declare const getTargetElement: (target: any) => any;
|
||||
declare const stylesInDom: any;
|
||||
declare function getIndexByIdentifier(identifier: any): number;
|
||||
declare function modulesToDom(list: any, options: any): string[];
|
||||
declare function insertStyleElement(options: any): HTMLStyleElement;
|
||||
declare function removeStyleElement(style: any): false | undefined;
|
||||
declare const replaceText: (index: any, replacement: any) => any;
|
||||
declare function applyToSingletonTag(style: any, index: any, remove: any, obj: any): void;
|
||||
declare function applyToTag(style: any, _options: any, obj: any): void;
|
||||
declare let singleton: any;
|
||||
declare let singletonCounter: number;
|
||||
declare function addStyle(obj: any, options: any): (newObj: any) => void;
|
||||
Generated
Vendored
+221
@@ -0,0 +1,221 @@
|
||||
/// <reference types="webpack/module.d.ts" />
|
||||
"use strict";
|
||||
const isOldIE = function isOldIE() {
|
||||
let memo;
|
||||
return function memorize() {
|
||||
if (typeof memo === 'undefined') {
|
||||
// Test for IE <= 9 as proposed by Browserhacks
|
||||
// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
|
||||
// Tests for existence of standard globals is to allow style-loader
|
||||
// to operate correctly into non-standard environments
|
||||
// @see https://github.com/webpack-contrib/style-loader/issues/177
|
||||
memo = Boolean(window && document && document.all && !window.atob);
|
||||
}
|
||||
return memo;
|
||||
};
|
||||
}();
|
||||
const getTargetElement = function() {
|
||||
const memo = {};
|
||||
return function memorize(target) {
|
||||
if (typeof memo[target] === 'undefined') {
|
||||
let styleTarget = document.querySelector(target);
|
||||
// Special case to return head of iframe instead of iframe itself
|
||||
if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
|
||||
try {
|
||||
// This will throw an exception if access to iframe is blocked
|
||||
// due to cross-origin restrictions
|
||||
styleTarget = styleTarget.contentDocument.head;
|
||||
} catch (e) {
|
||||
// istanbul ignore next
|
||||
styleTarget = null;
|
||||
}
|
||||
}
|
||||
memo[target] = styleTarget;
|
||||
}
|
||||
return memo[target];
|
||||
};
|
||||
}();
|
||||
const stylesInDom = [];
|
||||
function getIndexByIdentifier(identifier) {
|
||||
let result = -1;
|
||||
for(let i = 0; i < stylesInDom.length; i++){
|
||||
if (stylesInDom[i].identifier === identifier) {
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function modulesToDom(list, options) {
|
||||
const idCountMap = {};
|
||||
const identifiers = [];
|
||||
for(let i = 0; i < list.length; i++){
|
||||
const item = list[i];
|
||||
const id = options.base ? item[0] + options.base : item[0];
|
||||
const count = idCountMap[id] || 0;
|
||||
const identifier = id + ' ' + count.toString();
|
||||
idCountMap[id] = count + 1;
|
||||
const index = getIndexByIdentifier(identifier);
|
||||
const obj = {
|
||||
css: item[1],
|
||||
media: item[2],
|
||||
sourceMap: item[3]
|
||||
};
|
||||
if (index !== -1) {
|
||||
stylesInDom[index].references++;
|
||||
stylesInDom[index].updater(obj);
|
||||
} else {
|
||||
stylesInDom.push({
|
||||
identifier: identifier,
|
||||
updater: addStyle(obj, options),
|
||||
references: 1
|
||||
});
|
||||
}
|
||||
identifiers.push(identifier);
|
||||
}
|
||||
return identifiers;
|
||||
}
|
||||
function insertStyleElement(options) {
|
||||
const style = document.createElement('style');
|
||||
const attributes = options.attributes || {};
|
||||
if (typeof attributes.nonce === 'undefined') {
|
||||
const nonce = typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null;
|
||||
if (nonce) {
|
||||
attributes.nonce = nonce;
|
||||
}
|
||||
}
|
||||
Object.keys(attributes).forEach(function(key) {
|
||||
style.setAttribute(key, attributes[key]);
|
||||
});
|
||||
if (typeof options.insert === 'function') {
|
||||
options.insert(style);
|
||||
} else {
|
||||
const target = getTargetElement(options.insert || 'head');
|
||||
if (!target) {
|
||||
throw Object.defineProperty(new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."), "__NEXT_ERROR_CODE", {
|
||||
value: "E245",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
target.appendChild(style);
|
||||
}
|
||||
return style;
|
||||
}
|
||||
function removeStyleElement(style) {
|
||||
// istanbul ignore if
|
||||
if (style.parentNode === null) {
|
||||
return false;
|
||||
}
|
||||
style.parentNode.removeChild(style);
|
||||
}
|
||||
/* istanbul ignore next */ const replaceText = function replaceText() {
|
||||
const textStore = [];
|
||||
return function replace(index, replacement) {
|
||||
textStore[index] = replacement;
|
||||
return textStore.filter(Boolean).join('\n');
|
||||
};
|
||||
}();
|
||||
function applyToSingletonTag(style, index, remove, obj) {
|
||||
const css = remove ? '' : obj.media ? '@media ' + obj.media + ' {' + obj.css + '}' : obj.css;
|
||||
// For old IE
|
||||
/* istanbul ignore if */ if (style.styleSheet) {
|
||||
style.styleSheet.cssText = replaceText(index, css);
|
||||
} else {
|
||||
const cssNode = document.createTextNode(css);
|
||||
const childNodes = style.childNodes;
|
||||
if (childNodes[index]) {
|
||||
style.removeChild(childNodes[index]);
|
||||
}
|
||||
if (childNodes.length) {
|
||||
style.insertBefore(cssNode, childNodes[index]);
|
||||
} else {
|
||||
style.appendChild(cssNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
function applyToTag(style, _options, obj) {
|
||||
let css = obj.css;
|
||||
const media = obj.media;
|
||||
const sourceMap = obj.sourceMap;
|
||||
if (media) {
|
||||
style.setAttribute('media', media);
|
||||
} else {
|
||||
style.removeAttribute('media');
|
||||
}
|
||||
if (sourceMap && typeof btoa !== 'undefined') {
|
||||
css += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + ' */';
|
||||
}
|
||||
// For old IE
|
||||
/* istanbul ignore if */ if (style.styleSheet) {
|
||||
style.styleSheet.cssText = css;
|
||||
} else {
|
||||
while(style.firstChild){
|
||||
style.removeChild(style.firstChild);
|
||||
}
|
||||
style.appendChild(document.createTextNode(css));
|
||||
}
|
||||
}
|
||||
let singleton = null;
|
||||
let singletonCounter = 0;
|
||||
function addStyle(obj, options) {
|
||||
let style;
|
||||
let update;
|
||||
let remove;
|
||||
if (options.singleton) {
|
||||
const styleIndex = singletonCounter++;
|
||||
style = singleton || (singleton = insertStyleElement(options));
|
||||
update = applyToSingletonTag.bind(null, style, styleIndex, false);
|
||||
remove = applyToSingletonTag.bind(null, style, styleIndex, true);
|
||||
} else {
|
||||
style = insertStyleElement(options);
|
||||
update = applyToTag.bind(null, style, options);
|
||||
remove = function() {
|
||||
removeStyleElement(style);
|
||||
};
|
||||
}
|
||||
update(obj);
|
||||
return function updateStyle(newObj) {
|
||||
if (newObj) {
|
||||
if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {
|
||||
return;
|
||||
}
|
||||
update(obj = newObj);
|
||||
} else {
|
||||
remove();
|
||||
}
|
||||
};
|
||||
}
|
||||
module.exports = function(list, options) {
|
||||
options = options || {};
|
||||
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
|
||||
// tags it will allow on a page
|
||||
if (!options.singleton && typeof options.singleton !== 'boolean') {
|
||||
options.singleton = isOldIE();
|
||||
}
|
||||
list = list || [];
|
||||
let lastIdentifiers = modulesToDom(list, options);
|
||||
return function update(newList) {
|
||||
newList = newList || [];
|
||||
if (Object.prototype.toString.call(newList) !== '[object Array]') {
|
||||
return;
|
||||
}
|
||||
for(let i = 0; i < lastIdentifiers.length; i++){
|
||||
const identifier = lastIdentifiers[i];
|
||||
const index = getIndexByIdentifier(identifier);
|
||||
stylesInDom[index].references--;
|
||||
}
|
||||
const newLastIdentifiers = modulesToDom(newList, options);
|
||||
for(let i = 0; i < lastIdentifiers.length; i++){
|
||||
const identifier = lastIdentifiers[i];
|
||||
const index = getIndexByIdentifier(identifier);
|
||||
if (stylesInDom[index].references === 0) {
|
||||
stylesInDom[index].updater();
|
||||
stylesInDom.splice(index, 1);
|
||||
}
|
||||
}
|
||||
lastIdentifiers = newLastIdentifiers;
|
||||
};
|
||||
};
|
||||
|
||||
//# sourceMappingURL=injectStylesIntoStyleTag.js.map
|
||||
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
declare function isEqualLocals(a: any, b: any, isNamedExport: any): boolean;
|
||||
Generated
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
function isEqualLocals(a, b, isNamedExport) {
|
||||
if (!a && b || a && !b) {
|
||||
return false;
|
||||
}
|
||||
let p;
|
||||
for(p in a){
|
||||
if (isNamedExport && p === 'default') {
|
||||
continue;
|
||||
}
|
||||
if (a[p] !== b[p]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for(p in b){
|
||||
if (isNamedExport && p === 'default') {
|
||||
continue;
|
||||
}
|
||||
if (!a[p]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
module.exports = isEqualLocals;
|
||||
|
||||
//# sourceMappingURL=isEqualLocals.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../../src/build/webpack/loaders/next-style-loader/runtime/isEqualLocals.ts"],"sourcesContent":["function isEqualLocals(a: any, b: any, isNamedExport: any) {\n if ((!a && b) || (a && !b)) {\n return false\n }\n\n let p\n\n for (p in a) {\n if (isNamedExport && p === 'default') {\n continue\n }\n\n if (a[p] !== b[p]) {\n return false\n }\n }\n\n for (p in b) {\n if (isNamedExport && p === 'default') {\n continue\n }\n\n if (!a[p]) {\n return false\n }\n }\n\n return true\n}\n\nmodule.exports = isEqualLocals\n"],"names":["isEqualLocals","a","b","isNamedExport","p","module","exports"],"mappings":";AAAA,SAASA,cAAcC,CAAM,EAAEC,CAAM,EAAEC,aAAkB;IACvD,IAAI,AAAC,CAACF,KAAKC,KAAOD,KAAK,CAACC,GAAI;QAC1B,OAAO;IACT;IAEA,IAAIE;IAEJ,IAAKA,KAAKH,EAAG;QACX,IAAIE,iBAAiBC,MAAM,WAAW;YACpC;QACF;QAEA,IAAIH,CAAC,CAACG,EAAE,KAAKF,CAAC,CAACE,EAAE,EAAE;YACjB,OAAO;QACT;IACF;IAEA,IAAKA,KAAKF,EAAG;QACX,IAAIC,iBAAiBC,MAAM,WAAW;YACpC;QACF;QAEA,IAAI,CAACH,CAAC,CAACG,EAAE,EAAE;YACT,OAAO;QACT;IACF;IAEA,OAAO;AACT;AAEAC,OAAOC,OAAO,GAAGN","ignoreList":[0]}
|
||||
Reference in New Issue
Block a user