|
1 | 1 | import { parse, serialize } from 'cookie'; |
| 2 | +import { DEV } from 'esm-env'; |
2 | 3 | import { normalize_path, resolve } from '../../utils/url.js'; |
3 | 4 | import { add_data_suffix } from '../pathname.js'; |
4 | 5 | import { text_encoder } from '../utils.js'; |
@@ -96,7 +97,7 @@ export function get_cookies(request, url) { |
96 | 97 | // in development, if the cookie was set during this session with `cookies.set`, |
97 | 98 | // but at a different path, warn the user. (ignore cookies from request headers, |
98 | 99 | // since we don't know which path they were set at) |
99 | | - if (__SVELTEKIT_DEV__ && !cookie) { |
| 100 | + if (DEV && !cookie) { |
100 | 101 | const paths = Array.from(cookie_paths[name] ?? []).filter((path) => { |
101 | 102 | // we only care about paths that are _more_ specific than the current path |
102 | 103 | return path_matches(path, url.pathname) && path !== url.pathname; |
@@ -252,7 +253,7 @@ export function get_cookies(request, url) { |
252 | 253 | const cookie = { name, value, options: { ...options, path } }; |
253 | 254 | new_cookies.set(cookie_key, cookie); |
254 | 255 |
|
255 | | - if (__SVELTEKIT_DEV__) { |
| 256 | + if (DEV) { |
256 | 257 | const serialized = serialize(name, value, cookie.options); |
257 | 258 | if (text_encoder.encode(serialized).byteLength > MAX_COOKIE_SIZE) { |
258 | 259 | throw new Error(`Cookie "${name}" is too large, and will be discarded by the browser`); |
|
0 commit comments