Initial commit
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
export declare const createRenderParamsFromClient: typeof import("./params.browser.dev").makeDynamicallyTrackedExoticParamsWithDevWarnings;
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import type { Params } from '../../server/request/params';
|
||||
export declare function makeDynamicallyTrackedExoticParamsWithDevWarnings(underlyingParams: Params): Promise<Params>;
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "makeDynamicallyTrackedExoticParamsWithDevWarnings", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return makeDynamicallyTrackedExoticParamsWithDevWarnings;
|
||||
}
|
||||
});
|
||||
const _reflect = require("../../server/web/spec-extension/adapters/reflect");
|
||||
const _invarianterror = require("../../shared/lib/invariant-error");
|
||||
const _reflectutils = require("../../shared/lib/utils/reflect-utils");
|
||||
const CachedParams = new WeakMap();
|
||||
function makeDynamicallyTrackedExoticParamsWithDevWarnings(underlyingParams) {
|
||||
const cachedParams = CachedParams.get(underlyingParams);
|
||||
if (cachedParams) {
|
||||
return cachedParams;
|
||||
}
|
||||
// We don't use makeResolvedReactPromise here because params
|
||||
// supports copying with spread and we don't want to unnecessarily
|
||||
// instrument the promise with spreadable properties of ReactPromise.
|
||||
const promise = Promise.resolve(underlyingParams);
|
||||
const proxiedProperties = new Set();
|
||||
const unproxiedProperties = [];
|
||||
Object.keys(underlyingParams).forEach((prop)=>{
|
||||
if (_reflectutils.wellKnownProperties.has(prop)) {
|
||||
// These properties cannot be shadowed because they need to be the
|
||||
// true underlying value for Promises to work correctly at runtime
|
||||
} else {
|
||||
proxiedProperties.add(prop);
|
||||
promise[prop] = underlyingParams[prop];
|
||||
}
|
||||
});
|
||||
const proxiedPromise = new Proxy(promise, {
|
||||
get (target, prop, receiver) {
|
||||
if (typeof prop === 'string') {
|
||||
if (// We are accessing a property that was proxied to the promise instance
|
||||
proxiedProperties.has(prop)) {
|
||||
const expression = (0, _reflectutils.describeStringPropertyAccess)('params', prop);
|
||||
warnForSyncAccess(expression);
|
||||
}
|
||||
}
|
||||
return _reflect.ReflectAdapter.get(target, prop, receiver);
|
||||
},
|
||||
set (target, prop, value, receiver) {
|
||||
if (typeof prop === 'string') {
|
||||
proxiedProperties.delete(prop);
|
||||
}
|
||||
return _reflect.ReflectAdapter.set(target, prop, value, receiver);
|
||||
},
|
||||
ownKeys (target) {
|
||||
warnForEnumeration(unproxiedProperties);
|
||||
return Reflect.ownKeys(target);
|
||||
}
|
||||
});
|
||||
CachedParams.set(underlyingParams, proxiedPromise);
|
||||
return proxiedPromise;
|
||||
}
|
||||
function warnForSyncAccess(expression) {
|
||||
console.error("A param property was accessed directly with " + expression + ". `params` is now a Promise and should be unwrapped with `React.use()` before accessing properties of the underlying params object. In this version of Next.js direct access to param properties is still supported to facilitate migration but in a future version you will be required to unwrap `params` with `React.use()`.");
|
||||
}
|
||||
function warnForEnumeration(missingProperties) {
|
||||
if (missingProperties.length) {
|
||||
const describedMissingProperties = describeListOfPropertyNames(missingProperties);
|
||||
console.error("params are being enumerated incompletely missing these properties: " + describedMissingProperties + ". " + "`params` should be unwrapped with `React.use()` before using its value. " + "Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis");
|
||||
} else {
|
||||
console.error("params are being enumerated. " + "`params` should be unwrapped with `React.use()` before using its value. " + "Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis");
|
||||
}
|
||||
}
|
||||
function describeListOfPropertyNames(properties) {
|
||||
switch(properties.length){
|
||||
case 0:
|
||||
throw Object.defineProperty(new _invarianterror.InvariantError('Expected describeListOfPropertyNames to be called with a non-empty list of strings.'), "__NEXT_ERROR_CODE", {
|
||||
value: "E531",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
case 1:
|
||||
return "`" + properties[0] + "`";
|
||||
case 2:
|
||||
return "`" + properties[0] + "` and `" + properties[1] + "`";
|
||||
default:
|
||||
{
|
||||
let description = '';
|
||||
for(let i = 0; i < properties.length - 1; i++){
|
||||
description += "`" + properties[i] + "`, ";
|
||||
}
|
||||
description += ", and `" + properties[properties.length - 1] + "`";
|
||||
return description;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=params.browser.dev.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+19
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "createRenderParamsFromClient", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return createRenderParamsFromClient;
|
||||
}
|
||||
});
|
||||
const createRenderParamsFromClient = process.env.NODE_ENV === 'development' ? require('./params.browser.dev').makeDynamicallyTrackedExoticParamsWithDevWarnings : require('./params.browser.prod').makeUntrackedExoticParams;
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=params.browser.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/request/params.browser.ts"],"sourcesContent":["export const createRenderParamsFromClient =\n process.env.NODE_ENV === 'development'\n ? (require('./params.browser.dev') as typeof import('./params.browser.dev'))\n .makeDynamicallyTrackedExoticParamsWithDevWarnings\n : (\n require('./params.browser.prod') as typeof import('./params.browser.prod')\n ).makeUntrackedExoticParams\n"],"names":["createRenderParamsFromClient","process","env","NODE_ENV","require","makeDynamicallyTrackedExoticParamsWithDevWarnings","makeUntrackedExoticParams"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,+BACXC,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBACrB,AAACC,QAAQ,wBACNC,iDAAiD,GACpD,AACED,QAAQ,yBACRE,yBAAyB"}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import type { Params } from '../../server/request/params';
|
||||
export declare function makeUntrackedExoticParams(underlyingParams: Params): Promise<Params>;
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "makeUntrackedExoticParams", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return makeUntrackedExoticParams;
|
||||
}
|
||||
});
|
||||
const _reflectutils = require("../../shared/lib/utils/reflect-utils");
|
||||
const CachedParams = new WeakMap();
|
||||
function makeUntrackedExoticParams(underlyingParams) {
|
||||
const cachedParams = CachedParams.get(underlyingParams);
|
||||
if (cachedParams) {
|
||||
return cachedParams;
|
||||
}
|
||||
const promise = Promise.resolve(underlyingParams);
|
||||
CachedParams.set(underlyingParams, promise);
|
||||
Object.keys(underlyingParams).forEach((prop)=>{
|
||||
if (_reflectutils.wellKnownProperties.has(prop)) {
|
||||
// These properties cannot be shadowed because they need to be the
|
||||
// true underlying value for Promises to work correctly at runtime
|
||||
} else {
|
||||
;
|
||||
promise[prop] = underlyingParams[prop];
|
||||
}
|
||||
});
|
||||
return promise;
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=params.browser.prod.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/request/params.browser.prod.ts"],"sourcesContent":["import type { Params } from '../../server/request/params'\nimport { wellKnownProperties } from '../../shared/lib/utils/reflect-utils'\n\ninterface CacheLifetime {}\nconst CachedParams = new WeakMap<CacheLifetime, Promise<Params>>()\n\nexport function makeUntrackedExoticParams(\n underlyingParams: Params\n): Promise<Params> {\n const cachedParams = CachedParams.get(underlyingParams)\n if (cachedParams) {\n return cachedParams\n }\n\n const promise = Promise.resolve(underlyingParams)\n CachedParams.set(underlyingParams, promise)\n\n Object.keys(underlyingParams).forEach((prop) => {\n if (wellKnownProperties.has(prop)) {\n // These properties cannot be shadowed because they need to be the\n // true underlying value for Promises to work correctly at runtime\n } else {\n ;(promise as any)[prop] = underlyingParams[prop]\n }\n })\n\n return promise\n}\n"],"names":["makeUntrackedExoticParams","CachedParams","WeakMap","underlyingParams","cachedParams","get","promise","Promise","resolve","set","Object","keys","forEach","prop","wellKnownProperties","has"],"mappings":";;;;+BAMgBA;;;eAAAA;;;8BALoB;AAGpC,MAAMC,eAAe,IAAIC;AAElB,SAASF,0BACdG,gBAAwB;IAExB,MAAMC,eAAeH,aAAaI,GAAG,CAACF;IACtC,IAAIC,cAAc;QAChB,OAAOA;IACT;IAEA,MAAME,UAAUC,QAAQC,OAAO,CAACL;IAChCF,aAAaQ,GAAG,CAACN,kBAAkBG;IAEnCI,OAAOC,IAAI,CAACR,kBAAkBS,OAAO,CAAC,CAACC;QACrC,IAAIC,iCAAmB,CAACC,GAAG,CAACF,OAAO;QACjC,kEAAkE;QAClE,kEAAkE;QACpE,OAAO;;YACHP,OAAe,CAACO,KAAK,GAAGV,gBAAgB,CAACU,KAAK;QAClD;IACF;IAEA,OAAOP;AACT"}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export declare const createRenderSearchParamsFromClient: typeof import("./search-params.browser.dev").makeUntrackedExoticSearchParamsWithDevWarnings;
|
||||
Generated
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
import type { SearchParams } from '../../server/request/search-params';
|
||||
export declare function makeUntrackedExoticSearchParamsWithDevWarnings(underlyingSearchParams: SearchParams): Promise<SearchParams>;
|
||||
Generated
Vendored
+82
@@ -0,0 +1,82 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "makeUntrackedExoticSearchParamsWithDevWarnings", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return makeUntrackedExoticSearchParamsWithDevWarnings;
|
||||
}
|
||||
});
|
||||
const _reflect = require("../../server/web/spec-extension/adapters/reflect");
|
||||
const _reflectutils = require("../../shared/lib/utils/reflect-utils");
|
||||
const CachedSearchParams = new WeakMap();
|
||||
function makeUntrackedExoticSearchParamsWithDevWarnings(underlyingSearchParams) {
|
||||
const cachedSearchParams = CachedSearchParams.get(underlyingSearchParams);
|
||||
if (cachedSearchParams) {
|
||||
return cachedSearchParams;
|
||||
}
|
||||
const proxiedProperties = new Set();
|
||||
const unproxiedProperties = [];
|
||||
const promise = Promise.resolve(underlyingSearchParams);
|
||||
Object.keys(underlyingSearchParams).forEach((prop)=>{
|
||||
if (_reflectutils.wellKnownProperties.has(prop)) {
|
||||
// These properties cannot be shadowed because they need to be the
|
||||
// true underlying value for Promises to work correctly at runtime
|
||||
unproxiedProperties.push(prop);
|
||||
} else {
|
||||
proxiedProperties.add(prop);
|
||||
promise[prop] = underlyingSearchParams[prop];
|
||||
}
|
||||
});
|
||||
const proxiedPromise = new Proxy(promise, {
|
||||
get (target, prop, receiver) {
|
||||
if (typeof prop === 'string') {
|
||||
if (!_reflectutils.wellKnownProperties.has(prop) && (proxiedProperties.has(prop) || // We are accessing a property that doesn't exist on the promise nor
|
||||
// the underlying searchParams.
|
||||
Reflect.has(target, prop) === false)) {
|
||||
const expression = (0, _reflectutils.describeStringPropertyAccess)('searchParams', prop);
|
||||
warnForSyncAccess(expression);
|
||||
}
|
||||
}
|
||||
return _reflect.ReflectAdapter.get(target, prop, receiver);
|
||||
},
|
||||
set (target, prop, value, receiver) {
|
||||
if (typeof prop === 'string') {
|
||||
proxiedProperties.delete(prop);
|
||||
}
|
||||
return Reflect.set(target, prop, value, receiver);
|
||||
},
|
||||
has (target, prop) {
|
||||
if (typeof prop === 'string') {
|
||||
if (!_reflectutils.wellKnownProperties.has(prop) && (proxiedProperties.has(prop) || // We are accessing a property that doesn't exist on the promise nor
|
||||
// the underlying searchParams.
|
||||
Reflect.has(target, prop) === false)) {
|
||||
const expression = (0, _reflectutils.describeHasCheckingStringProperty)('searchParams', prop);
|
||||
warnForSyncAccess(expression);
|
||||
}
|
||||
}
|
||||
return Reflect.has(target, prop);
|
||||
},
|
||||
ownKeys (target) {
|
||||
warnForSyncSpread();
|
||||
return Reflect.ownKeys(target);
|
||||
}
|
||||
});
|
||||
CachedSearchParams.set(underlyingSearchParams, proxiedPromise);
|
||||
return proxiedPromise;
|
||||
}
|
||||
function warnForSyncAccess(expression) {
|
||||
console.error("A searchParam property was accessed directly with " + expression + ". " + "`searchParams` should be unwrapped with `React.use()` before accessing its properties. " + "Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis");
|
||||
}
|
||||
function warnForSyncSpread() {
|
||||
console.error("The keys of `searchParams` were accessed directly. " + "`searchParams` should be unwrapped with `React.use()` before accessing its properties. " + "Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis");
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=search-params.browser.dev.js.map
|
||||
Generated
Vendored
+1
File diff suppressed because one or more lines are too long
+19
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "createRenderSearchParamsFromClient", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return createRenderSearchParamsFromClient;
|
||||
}
|
||||
});
|
||||
const createRenderSearchParamsFromClient = process.env.NODE_ENV === 'development' ? require('./search-params.browser.dev').makeUntrackedExoticSearchParamsWithDevWarnings : require('./search-params.browser.prod').makeUntrackedExoticSearchParams;
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=search-params.browser.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/request/search-params.browser.ts"],"sourcesContent":["export const createRenderSearchParamsFromClient =\n process.env.NODE_ENV === 'development'\n ? (\n require('./search-params.browser.dev') as typeof import('./search-params.browser.dev')\n ).makeUntrackedExoticSearchParamsWithDevWarnings\n : (\n require('./search-params.browser.prod') as typeof import('./search-params.browser.prod')\n ).makeUntrackedExoticSearchParams\n"],"names":["createRenderSearchParamsFromClient","process","env","NODE_ENV","require","makeUntrackedExoticSearchParamsWithDevWarnings","makeUntrackedExoticSearchParams"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,qCACXC,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBACrB,AACEC,QAAQ,+BACRC,8CAA8C,GAChD,AACED,QAAQ,gCACRE,+BAA+B"}
|
||||
Generated
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
import type { SearchParams } from '../../server/request/search-params';
|
||||
export declare function makeUntrackedExoticSearchParams(underlyingSearchParams: SearchParams): Promise<SearchParams>;
|
||||
Generated
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "makeUntrackedExoticSearchParams", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return makeUntrackedExoticSearchParams;
|
||||
}
|
||||
});
|
||||
const _reflectutils = require("../../shared/lib/utils/reflect-utils");
|
||||
const CachedSearchParams = new WeakMap();
|
||||
function makeUntrackedExoticSearchParams(underlyingSearchParams) {
|
||||
const cachedSearchParams = CachedSearchParams.get(underlyingSearchParams);
|
||||
if (cachedSearchParams) {
|
||||
return cachedSearchParams;
|
||||
}
|
||||
// We don't use makeResolvedReactPromise here because searchParams
|
||||
// supports copying with spread and we don't want to unnecessarily
|
||||
// instrument the promise with spreadable properties of ReactPromise.
|
||||
const promise = Promise.resolve(underlyingSearchParams);
|
||||
CachedSearchParams.set(underlyingSearchParams, promise);
|
||||
Object.keys(underlyingSearchParams).forEach((prop)=>{
|
||||
if (_reflectutils.wellKnownProperties.has(prop)) {
|
||||
// These properties cannot be shadowed because they need to be the
|
||||
// true underlying value for Promises to work correctly at runtime
|
||||
} else {
|
||||
;
|
||||
promise[prop] = underlyingSearchParams[prop];
|
||||
}
|
||||
});
|
||||
return promise;
|
||||
}
|
||||
|
||||
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
|
||||
Object.defineProperty(exports.default, '__esModule', { value: true });
|
||||
Object.assign(exports.default, exports);
|
||||
module.exports = exports.default;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=search-params.browser.prod.js.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/client/request/search-params.browser.prod.ts"],"sourcesContent":["import type { SearchParams } from '../../server/request/search-params'\n\nimport { wellKnownProperties } from '../../shared/lib/utils/reflect-utils'\n\ninterface CacheLifetime {}\nconst CachedSearchParams = new WeakMap<CacheLifetime, Promise<SearchParams>>()\n\nexport function makeUntrackedExoticSearchParams(\n underlyingSearchParams: SearchParams\n): Promise<SearchParams> {\n const cachedSearchParams = CachedSearchParams.get(underlyingSearchParams)\n if (cachedSearchParams) {\n return cachedSearchParams\n }\n\n // We don't use makeResolvedReactPromise here because searchParams\n // supports copying with spread and we don't want to unnecessarily\n // instrument the promise with spreadable properties of ReactPromise.\n const promise = Promise.resolve(underlyingSearchParams)\n CachedSearchParams.set(underlyingSearchParams, promise)\n\n Object.keys(underlyingSearchParams).forEach((prop) => {\n if (wellKnownProperties.has(prop)) {\n // These properties cannot be shadowed because they need to be the\n // true underlying value for Promises to work correctly at runtime\n } else {\n ;(promise as any)[prop] = underlyingSearchParams[prop]\n }\n })\n\n return promise\n}\n"],"names":["makeUntrackedExoticSearchParams","CachedSearchParams","WeakMap","underlyingSearchParams","cachedSearchParams","get","promise","Promise","resolve","set","Object","keys","forEach","prop","wellKnownProperties","has"],"mappings":";;;;+BAOgBA;;;eAAAA;;;8BALoB;AAGpC,MAAMC,qBAAqB,IAAIC;AAExB,SAASF,gCACdG,sBAAoC;IAEpC,MAAMC,qBAAqBH,mBAAmBI,GAAG,CAACF;IAClD,IAAIC,oBAAoB;QACtB,OAAOA;IACT;IAEA,kEAAkE;IAClE,kEAAkE;IAClE,qEAAqE;IACrE,MAAME,UAAUC,QAAQC,OAAO,CAACL;IAChCF,mBAAmBQ,GAAG,CAACN,wBAAwBG;IAE/CI,OAAOC,IAAI,CAACR,wBAAwBS,OAAO,CAAC,CAACC;QAC3C,IAAIC,iCAAmB,CAACC,GAAG,CAACF,OAAO;QACjC,kEAAkE;QAClE,kEAAkE;QACpE,OAAO;;YACHP,OAAe,CAACO,KAAK,GAAGV,sBAAsB,CAACU,KAAK;QACxD;IACF;IAEA,OAAOP;AACT"}
|
||||
Reference in New Issue
Block a user