mirror of
https://gitee.com/onvia/ccc-tnt-psd2ui
synced 2024-12-26 03:38:24 +00:00
Merge branch 'master' of https://gitee.com/onvia/ccc-tnt-psd2ui
This commit is contained in:
commit
f4a7801d33
4
ccc-tnt-psd2ui-v2.4.x/package-lock.json
generated
4
ccc-tnt-psd2ui-v2.4.x/package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ccc-tnt-psd2ui",
|
"name": "ccc-tnt-psd2ui",
|
||||||
"version": "0.0.1",
|
"version": "1.0.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ccc-tnt-psd2ui",
|
"name": "ccc-tnt-psd2ui",
|
||||||
"version": "0.0.1",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ag-psd": "^15.0.0",
|
"ag-psd": "^15.0.0",
|
||||||
"canvas": "^2.10.2",
|
"canvas": "^2.10.2",
|
||||||
|
909
ccc-tnt-psd2ui-v3.4.+/package-lock.json
generated
909
ccc-tnt-psd2ui-v3.4.+/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
npm-packages/mac-v2.4.x/.package-lock.json
generated
10
npm-packages/mac-v2.4.x/.package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ccc-tnt-psd2ui",
|
"name": "ccc-tnt-psd2ui",
|
||||||
"version": "0.0.1",
|
"version": "1.0.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
@ -388,8 +388,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/node-fetch": {
|
"node_modules/node-fetch": {
|
||||||
"version": "2.6.7",
|
"version": "2.7.0",
|
||||||
"license": "MIT",
|
"resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||||
|
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"whatwg-url": "^5.0.0"
|
"whatwg-url": "^5.0.0"
|
||||||
},
|
},
|
||||||
@ -455,8 +456,7 @@
|
|||||||
},
|
},
|
||||||
"node_modules/pinyin-pro": {
|
"node_modules/pinyin-pro": {
|
||||||
"version": "3.16.0",
|
"version": "3.16.0",
|
||||||
"resolved": "https://registry.npmmirror.com/pinyin-pro/-/pinyin-pro-3.16.0.tgz",
|
"license": "MIT"
|
||||||
"integrity": "sha512-U4pMQ/KSMM5JmSb+ZcReCIbgzGl/JaglaHqWjCli0hpA0rDdjRbAO67e6fOa3ZFcJzbqfe6bJkaMMmpiWmkXgQ=="
|
|
||||||
},
|
},
|
||||||
"node_modules/readable-stream": {
|
"node_modules/readable-stream": {
|
||||||
"version": "3.6.0",
|
"version": "3.6.0",
|
||||||
|
@ -332,7 +332,7 @@ endif
|
|||||||
|
|
||||||
quiet_cmd_regen_makefile = ACTION Regenerating $@
|
quiet_cmd_regen_makefile = ACTION Regenerating $@
|
||||||
cmd_regen_makefile = cd $(srcdir); /Users/wsl/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/wsl/Library/Caches/node-gyp/16.14.0" "-Dnode_gyp_dir=/Users/wsl/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=/Users/wsl/Library/Caches/node-gyp/16.14.0/<(target_arch)/node.lib" "-Dmodule_root_dir=/Users/wsl/Documents/Git/ccc-tnt-psd2ui/ccc-tnt-psd2ui-v2.4.x/node_modules/canvas" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/Users/wsl/Documents/Git/ccc-tnt-psd2ui/ccc-tnt-psd2ui-v2.4.x/node_modules/canvas/build/config.gypi -I/Users/wsl/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/wsl/Library/Caches/node-gyp/16.14.0/include/node/common.gypi "--toplevel-dir=." binding.gyp
|
cmd_regen_makefile = cd $(srcdir); /Users/wsl/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/wsl/Library/Caches/node-gyp/16.14.0" "-Dnode_gyp_dir=/Users/wsl/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=/Users/wsl/Library/Caches/node-gyp/16.14.0/<(target_arch)/node.lib" "-Dmodule_root_dir=/Users/wsl/Documents/Git/ccc-tnt-psd2ui/ccc-tnt-psd2ui-v2.4.x/node_modules/canvas" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/Users/wsl/Documents/Git/ccc-tnt-psd2ui/ccc-tnt-psd2ui-v2.4.x/node_modules/canvas/build/config.gypi -I/Users/wsl/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/wsl/Library/Caches/node-gyp/16.14.0/include/node/common.gypi "--toplevel-dir=." binding.gyp
|
||||||
Makefile: $(srcdir)/binding.gyp $(srcdir)/../../../../../../Library/Caches/node-gyp/16.14.0/include/node/common.gypi $(srcdir)/build/config.gypi $(srcdir)/../../../../../../.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi
|
Makefile: $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../../Library/Caches/node-gyp/16.14.0/include/node/common.gypi $(srcdir)/../../../../../../.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi
|
||||||
$(call do_cmd,regen_makefile)
|
$(call do_cmd,regen_makefile)
|
||||||
|
|
||||||
# "all" is a concatenation of the "all" targets from all the included
|
# "all" is a concatenation of the "all" targets from all the included
|
||||||
|
Binary file not shown.
@ -188,6 +188,49 @@ fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png')
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
In Node.js 14 you can also use async iterators to read `body`; however, be careful to catch
|
||||||
|
errors -- the longer a response runs, the more likely it is to encounter an error.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const fetch = require('node-fetch');
|
||||||
|
const response = await fetch('https://httpbin.org/stream/3');
|
||||||
|
try {
|
||||||
|
for await (const chunk of response.body) {
|
||||||
|
console.dir(JSON.parse(chunk.toString()));
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err.stack);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
In Node.js 12 you can also use async iterators to read `body`; however, async iterators with streams
|
||||||
|
did not mature until Node.js 14, so you need to do some extra work to ensure you handle errors
|
||||||
|
directly from the stream and wait on it response to fully close.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const fetch = require('node-fetch');
|
||||||
|
const read = async body => {
|
||||||
|
let error;
|
||||||
|
body.on('error', err => {
|
||||||
|
error = err;
|
||||||
|
});
|
||||||
|
for await (const chunk of body) {
|
||||||
|
console.dir(JSON.parse(chunk.toString()));
|
||||||
|
}
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
body.on('close', () => {
|
||||||
|
error ? reject(error) : resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
const response = await fetch('https://httpbin.org/stream/3');
|
||||||
|
await read(response.body);
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err.stack);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
#### Buffer
|
#### Buffer
|
||||||
If you prefer to cache binary data in full, use buffer(). (NOTE: `buffer()` is a `node-fetch`-only API)
|
If you prefer to cache binary data in full, use buffer(). (NOTE: `buffer()` is a `node-fetch`-only API)
|
||||||
|
|
||||||
@ -344,7 +387,6 @@ Header | Value
|
|||||||
------------------- | --------------------------------------------------------
|
------------------- | --------------------------------------------------------
|
||||||
`Accept-Encoding` | `gzip,deflate` _(when `options.compress === true`)_
|
`Accept-Encoding` | `gzip,deflate` _(when `options.compress === true`)_
|
||||||
`Accept` | `*/*`
|
`Accept` | `*/*`
|
||||||
`Connection` | `close` _(when no `options.agent` is present)_
|
|
||||||
`Content-Length` | _(automatically calculated, if possible)_
|
`Content-Length` | _(automatically calculated, if possible)_
|
||||||
`Transfer-Encoding` | `chunked` _(when `req.body` is a stream)_
|
`Transfer-Encoding` | `chunked` _(when `req.body` is a stream)_
|
||||||
`User-Agent` | `node-fetch/1.0 (+https://github.com/bitinn/node-fetch)`
|
`User-Agent` | `node-fetch/1.0 (+https://github.com/bitinn/node-fetch)`
|
||||||
@ -361,6 +403,8 @@ The `agent` option allows you to specify networking related options which are ou
|
|||||||
|
|
||||||
See [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) for more information.
|
See [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) for more information.
|
||||||
|
|
||||||
|
If no agent is specified, the default agent provided by Node.js is used. Note that [this changed in Node.js 19](https://github.com/nodejs/node/blob/4267b92604ad78584244488e7f7508a690cb80d0/lib/_http_agent.js#L564) to have `keepalive` true by default. If you wish to enable `keepalive` in an earlier version of Node.js, you can override the agent as per the following code sample.
|
||||||
|
|
||||||
In addition, the `agent` option accepts a function that returns `http`(s)`.Agent` instance given current [URL](https://nodejs.org/api/url.html), this is useful during a redirection chain across HTTP and HTTPS protocol.
|
In addition, the `agent` option accepts a function that returns `http`(s)`.Agent` instance given current [URL](https://nodejs.org/api/url.html), this is useful during a redirection chain across HTTP and HTTPS protocol.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
@ -11,15 +11,15 @@ var getGlobal = function () {
|
|||||||
throw new Error('unable to locate global object');
|
throw new Error('unable to locate global object');
|
||||||
}
|
}
|
||||||
|
|
||||||
var global = getGlobal();
|
var globalObject = getGlobal();
|
||||||
|
|
||||||
module.exports = exports = global.fetch;
|
module.exports = exports = globalObject.fetch;
|
||||||
|
|
||||||
// Needed for TypeScript and Webpack.
|
// Needed for TypeScript and Webpack.
|
||||||
if (global.fetch) {
|
if (globalObject.fetch) {
|
||||||
exports.default = global.fetch.bind(global);
|
exports.default = globalObject.fetch.bind(globalObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.Headers = global.Headers;
|
exports.Headers = globalObject.Headers;
|
||||||
exports.Request = global.Request;
|
exports.Request = globalObject.Request;
|
||||||
exports.Response = global.Response;
|
exports.Response = globalObject.Response;
|
||||||
|
@ -1361,10 +1361,6 @@ function getNodeRequestOptions(request) {
|
|||||||
agent = agent(parsedURL);
|
agent = agent(parsedURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!headers.has('Connection') && !agent) {
|
|
||||||
headers.set('Connection', 'close');
|
|
||||||
}
|
|
||||||
|
|
||||||
// HTTP-network fetch step 4.2
|
// HTTP-network fetch step 4.2
|
||||||
// chunked encoding is handled by Node.js
|
// chunked encoding is handled by Node.js
|
||||||
|
|
||||||
@ -1413,6 +1409,20 @@ const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original)
|
|||||||
return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
|
return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* isSameProtocol reports whether the two provided URLs use the same protocol.
|
||||||
|
*
|
||||||
|
* Both domains must already be in canonical form.
|
||||||
|
* @param {string|URL} original
|
||||||
|
* @param {string|URL} destination
|
||||||
|
*/
|
||||||
|
const isSameProtocol = function isSameProtocol(destination, original) {
|
||||||
|
const orig = new URL$1(original).protocol;
|
||||||
|
const dest = new URL$1(destination).protocol;
|
||||||
|
|
||||||
|
return orig === dest;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch function
|
* Fetch function
|
||||||
*
|
*
|
||||||
@ -1444,7 +1454,7 @@ function fetch(url, opts) {
|
|||||||
let error = new AbortError('The user aborted a request.');
|
let error = new AbortError('The user aborted a request.');
|
||||||
reject(error);
|
reject(error);
|
||||||
if (request.body && request.body instanceof Stream.Readable) {
|
if (request.body && request.body instanceof Stream.Readable) {
|
||||||
request.body.destroy(error);
|
destroyStream(request.body, error);
|
||||||
}
|
}
|
||||||
if (!response || !response.body) return;
|
if (!response || !response.body) return;
|
||||||
response.body.emit('error', error);
|
response.body.emit('error', error);
|
||||||
@ -1485,9 +1495,43 @@ function fetch(url, opts) {
|
|||||||
|
|
||||||
req.on('error', function (err) {
|
req.on('error', function (err) {
|
||||||
reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
|
reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
|
||||||
|
|
||||||
|
if (response && response.body) {
|
||||||
|
destroyStream(response.body, err);
|
||||||
|
}
|
||||||
|
|
||||||
finalize();
|
finalize();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fixResponseChunkedTransferBadEnding(req, function (err) {
|
||||||
|
if (signal && signal.aborted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response && response.body) {
|
||||||
|
destroyStream(response.body, err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/* c8 ignore next 18 */
|
||||||
|
if (parseInt(process.version.substring(1)) < 14) {
|
||||||
|
// Before Node.js 14, pipeline() does not fully support async iterators and does not always
|
||||||
|
// properly handle when the socket close/end events are out of order.
|
||||||
|
req.on('socket', function (s) {
|
||||||
|
s.addListener('close', function (hadError) {
|
||||||
|
// if a data listener is still present we didn't end cleanly
|
||||||
|
const hasDataListener = s.listenerCount('data') > 0;
|
||||||
|
|
||||||
|
// if end happened before close but the socket didn't emit an error, do it now
|
||||||
|
if (response && hasDataListener && !hadError && !(signal && signal.aborted)) {
|
||||||
|
const err = new Error('Premature close');
|
||||||
|
err.code = 'ERR_STREAM_PREMATURE_CLOSE';
|
||||||
|
response.body.emit('error', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
req.on('response', function (res) {
|
req.on('response', function (res) {
|
||||||
clearTimeout(reqTimeout);
|
clearTimeout(reqTimeout);
|
||||||
|
|
||||||
@ -1559,7 +1603,7 @@ function fetch(url, opts) {
|
|||||||
size: request.size
|
size: request.size
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!isDomainOrSubdomain(request.url, locationURL)) {
|
if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {
|
||||||
for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
|
for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
|
||||||
requestOpts.headers.delete(name);
|
requestOpts.headers.delete(name);
|
||||||
}
|
}
|
||||||
@ -1652,6 +1696,13 @@ function fetch(url, opts) {
|
|||||||
response = new Response(body, response_options);
|
response = new Response(body, response_options);
|
||||||
resolve(response);
|
resolve(response);
|
||||||
});
|
});
|
||||||
|
raw.on('end', function () {
|
||||||
|
// some old IIS servers return zero-length OK deflate responses, so 'data' is never emitted.
|
||||||
|
if (!response) {
|
||||||
|
response = new Response(body, response_options);
|
||||||
|
resolve(response);
|
||||||
|
}
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1671,6 +1722,44 @@ function fetch(url, opts) {
|
|||||||
writeToStream(req, request);
|
writeToStream(req, request);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
||||||
|
let socket;
|
||||||
|
|
||||||
|
request.on('socket', function (s) {
|
||||||
|
socket = s;
|
||||||
|
});
|
||||||
|
|
||||||
|
request.on('response', function (response) {
|
||||||
|
const headers = response.headers;
|
||||||
|
|
||||||
|
if (headers['transfer-encoding'] === 'chunked' && !headers['content-length']) {
|
||||||
|
response.once('close', function (hadError) {
|
||||||
|
// tests for socket presence, as in some situations the
|
||||||
|
// the 'socket' event is not triggered for the request
|
||||||
|
// (happens in deno), avoids `TypeError`
|
||||||
|
// if a data listener is still present we didn't end cleanly
|
||||||
|
const hasDataListener = socket && socket.listenerCount('data') > 0;
|
||||||
|
|
||||||
|
if (hasDataListener && !hadError) {
|
||||||
|
const err = new Error('Premature close');
|
||||||
|
err.code = 'ERR_STREAM_PREMATURE_CLOSE';
|
||||||
|
errorCallback(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function destroyStream(stream, err) {
|
||||||
|
if (stream.destroy) {
|
||||||
|
stream.destroy(err);
|
||||||
|
} else {
|
||||||
|
// node < 8
|
||||||
|
stream.emit('error', err);
|
||||||
|
stream.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect code matching
|
* Redirect code matching
|
||||||
*
|
*
|
||||||
@ -1685,4 +1774,4 @@ fetch.isRedirect = function (code) {
|
|||||||
fetch.Promise = global.Promise;
|
fetch.Promise = global.Promise;
|
||||||
|
|
||||||
export default fetch;
|
export default fetch;
|
||||||
export { Headers, Request, Response, FetchError };
|
export { Headers, Request, Response, FetchError, AbortError };
|
||||||
|
@ -1365,10 +1365,6 @@ function getNodeRequestOptions(request) {
|
|||||||
agent = agent(parsedURL);
|
agent = agent(parsedURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!headers.has('Connection') && !agent) {
|
|
||||||
headers.set('Connection', 'close');
|
|
||||||
}
|
|
||||||
|
|
||||||
// HTTP-network fetch step 4.2
|
// HTTP-network fetch step 4.2
|
||||||
// chunked encoding is handled by Node.js
|
// chunked encoding is handled by Node.js
|
||||||
|
|
||||||
@ -1417,6 +1413,20 @@ const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original)
|
|||||||
return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
|
return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* isSameProtocol reports whether the two provided URLs use the same protocol.
|
||||||
|
*
|
||||||
|
* Both domains must already be in canonical form.
|
||||||
|
* @param {string|URL} original
|
||||||
|
* @param {string|URL} destination
|
||||||
|
*/
|
||||||
|
const isSameProtocol = function isSameProtocol(destination, original) {
|
||||||
|
const orig = new URL$1(original).protocol;
|
||||||
|
const dest = new URL$1(destination).protocol;
|
||||||
|
|
||||||
|
return orig === dest;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch function
|
* Fetch function
|
||||||
*
|
*
|
||||||
@ -1448,7 +1458,7 @@ function fetch(url, opts) {
|
|||||||
let error = new AbortError('The user aborted a request.');
|
let error = new AbortError('The user aborted a request.');
|
||||||
reject(error);
|
reject(error);
|
||||||
if (request.body && request.body instanceof Stream.Readable) {
|
if (request.body && request.body instanceof Stream.Readable) {
|
||||||
request.body.destroy(error);
|
destroyStream(request.body, error);
|
||||||
}
|
}
|
||||||
if (!response || !response.body) return;
|
if (!response || !response.body) return;
|
||||||
response.body.emit('error', error);
|
response.body.emit('error', error);
|
||||||
@ -1489,9 +1499,43 @@ function fetch(url, opts) {
|
|||||||
|
|
||||||
req.on('error', function (err) {
|
req.on('error', function (err) {
|
||||||
reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
|
reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
|
||||||
|
|
||||||
|
if (response && response.body) {
|
||||||
|
destroyStream(response.body, err);
|
||||||
|
}
|
||||||
|
|
||||||
finalize();
|
finalize();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fixResponseChunkedTransferBadEnding(req, function (err) {
|
||||||
|
if (signal && signal.aborted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response && response.body) {
|
||||||
|
destroyStream(response.body, err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/* c8 ignore next 18 */
|
||||||
|
if (parseInt(process.version.substring(1)) < 14) {
|
||||||
|
// Before Node.js 14, pipeline() does not fully support async iterators and does not always
|
||||||
|
// properly handle when the socket close/end events are out of order.
|
||||||
|
req.on('socket', function (s) {
|
||||||
|
s.addListener('close', function (hadError) {
|
||||||
|
// if a data listener is still present we didn't end cleanly
|
||||||
|
const hasDataListener = s.listenerCount('data') > 0;
|
||||||
|
|
||||||
|
// if end happened before close but the socket didn't emit an error, do it now
|
||||||
|
if (response && hasDataListener && !hadError && !(signal && signal.aborted)) {
|
||||||
|
const err = new Error('Premature close');
|
||||||
|
err.code = 'ERR_STREAM_PREMATURE_CLOSE';
|
||||||
|
response.body.emit('error', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
req.on('response', function (res) {
|
req.on('response', function (res) {
|
||||||
clearTimeout(reqTimeout);
|
clearTimeout(reqTimeout);
|
||||||
|
|
||||||
@ -1563,7 +1607,7 @@ function fetch(url, opts) {
|
|||||||
size: request.size
|
size: request.size
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!isDomainOrSubdomain(request.url, locationURL)) {
|
if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {
|
||||||
for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
|
for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
|
||||||
requestOpts.headers.delete(name);
|
requestOpts.headers.delete(name);
|
||||||
}
|
}
|
||||||
@ -1656,6 +1700,13 @@ function fetch(url, opts) {
|
|||||||
response = new Response(body, response_options);
|
response = new Response(body, response_options);
|
||||||
resolve(response);
|
resolve(response);
|
||||||
});
|
});
|
||||||
|
raw.on('end', function () {
|
||||||
|
// some old IIS servers return zero-length OK deflate responses, so 'data' is never emitted.
|
||||||
|
if (!response) {
|
||||||
|
response = new Response(body, response_options);
|
||||||
|
resolve(response);
|
||||||
|
}
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1675,6 +1726,44 @@ function fetch(url, opts) {
|
|||||||
writeToStream(req, request);
|
writeToStream(req, request);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
||||||
|
let socket;
|
||||||
|
|
||||||
|
request.on('socket', function (s) {
|
||||||
|
socket = s;
|
||||||
|
});
|
||||||
|
|
||||||
|
request.on('response', function (response) {
|
||||||
|
const headers = response.headers;
|
||||||
|
|
||||||
|
if (headers['transfer-encoding'] === 'chunked' && !headers['content-length']) {
|
||||||
|
response.once('close', function (hadError) {
|
||||||
|
// tests for socket presence, as in some situations the
|
||||||
|
// the 'socket' event is not triggered for the request
|
||||||
|
// (happens in deno), avoids `TypeError`
|
||||||
|
// if a data listener is still present we didn't end cleanly
|
||||||
|
const hasDataListener = socket && socket.listenerCount('data') > 0;
|
||||||
|
|
||||||
|
if (hasDataListener && !hadError) {
|
||||||
|
const err = new Error('Premature close');
|
||||||
|
err.code = 'ERR_STREAM_PREMATURE_CLOSE';
|
||||||
|
errorCallback(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function destroyStream(stream, err) {
|
||||||
|
if (stream.destroy) {
|
||||||
|
stream.destroy(err);
|
||||||
|
} else {
|
||||||
|
// node < 8
|
||||||
|
stream.emit('error', err);
|
||||||
|
stream.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect code matching
|
* Redirect code matching
|
||||||
*
|
*
|
||||||
@ -1695,3 +1784,4 @@ exports.Headers = Headers;
|
|||||||
exports.Request = Request;
|
exports.Request = Request;
|
||||||
exports.Response = Response;
|
exports.Response = Response;
|
||||||
exports.FetchError = FetchError;
|
exports.FetchError = FetchError;
|
||||||
|
exports.AbortError = AbortError;
|
||||||
|
@ -1359,10 +1359,6 @@ function getNodeRequestOptions(request) {
|
|||||||
agent = agent(parsedURL);
|
agent = agent(parsedURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!headers.has('Connection') && !agent) {
|
|
||||||
headers.set('Connection', 'close');
|
|
||||||
}
|
|
||||||
|
|
||||||
// HTTP-network fetch step 4.2
|
// HTTP-network fetch step 4.2
|
||||||
// chunked encoding is handled by Node.js
|
// chunked encoding is handled by Node.js
|
||||||
|
|
||||||
@ -1411,6 +1407,20 @@ const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original)
|
|||||||
return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
|
return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* isSameProtocol reports whether the two provided URLs use the same protocol.
|
||||||
|
*
|
||||||
|
* Both domains must already be in canonical form.
|
||||||
|
* @param {string|URL} original
|
||||||
|
* @param {string|URL} destination
|
||||||
|
*/
|
||||||
|
const isSameProtocol = function isSameProtocol(destination, original) {
|
||||||
|
const orig = new URL$1(original).protocol;
|
||||||
|
const dest = new URL$1(destination).protocol;
|
||||||
|
|
||||||
|
return orig === dest;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch function
|
* Fetch function
|
||||||
*
|
*
|
||||||
@ -1442,7 +1452,7 @@ function fetch(url, opts) {
|
|||||||
let error = new AbortError('The user aborted a request.');
|
let error = new AbortError('The user aborted a request.');
|
||||||
reject(error);
|
reject(error);
|
||||||
if (request.body && request.body instanceof Stream.Readable) {
|
if (request.body && request.body instanceof Stream.Readable) {
|
||||||
request.body.destroy(error);
|
destroyStream(request.body, error);
|
||||||
}
|
}
|
||||||
if (!response || !response.body) return;
|
if (!response || !response.body) return;
|
||||||
response.body.emit('error', error);
|
response.body.emit('error', error);
|
||||||
@ -1483,9 +1493,43 @@ function fetch(url, opts) {
|
|||||||
|
|
||||||
req.on('error', function (err) {
|
req.on('error', function (err) {
|
||||||
reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
|
reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
|
||||||
|
|
||||||
|
if (response && response.body) {
|
||||||
|
destroyStream(response.body, err);
|
||||||
|
}
|
||||||
|
|
||||||
finalize();
|
finalize();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fixResponseChunkedTransferBadEnding(req, function (err) {
|
||||||
|
if (signal && signal.aborted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response && response.body) {
|
||||||
|
destroyStream(response.body, err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/* c8 ignore next 18 */
|
||||||
|
if (parseInt(process.version.substring(1)) < 14) {
|
||||||
|
// Before Node.js 14, pipeline() does not fully support async iterators and does not always
|
||||||
|
// properly handle when the socket close/end events are out of order.
|
||||||
|
req.on('socket', function (s) {
|
||||||
|
s.addListener('close', function (hadError) {
|
||||||
|
// if a data listener is still present we didn't end cleanly
|
||||||
|
const hasDataListener = s.listenerCount('data') > 0;
|
||||||
|
|
||||||
|
// if end happened before close but the socket didn't emit an error, do it now
|
||||||
|
if (response && hasDataListener && !hadError && !(signal && signal.aborted)) {
|
||||||
|
const err = new Error('Premature close');
|
||||||
|
err.code = 'ERR_STREAM_PREMATURE_CLOSE';
|
||||||
|
response.body.emit('error', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
req.on('response', function (res) {
|
req.on('response', function (res) {
|
||||||
clearTimeout(reqTimeout);
|
clearTimeout(reqTimeout);
|
||||||
|
|
||||||
@ -1557,7 +1601,7 @@ function fetch(url, opts) {
|
|||||||
size: request.size
|
size: request.size
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!isDomainOrSubdomain(request.url, locationURL)) {
|
if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {
|
||||||
for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
|
for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
|
||||||
requestOpts.headers.delete(name);
|
requestOpts.headers.delete(name);
|
||||||
}
|
}
|
||||||
@ -1650,6 +1694,13 @@ function fetch(url, opts) {
|
|||||||
response = new Response(body, response_options);
|
response = new Response(body, response_options);
|
||||||
resolve(response);
|
resolve(response);
|
||||||
});
|
});
|
||||||
|
raw.on('end', function () {
|
||||||
|
// some old IIS servers return zero-length OK deflate responses, so 'data' is never emitted.
|
||||||
|
if (!response) {
|
||||||
|
response = new Response(body, response_options);
|
||||||
|
resolve(response);
|
||||||
|
}
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1669,6 +1720,44 @@ function fetch(url, opts) {
|
|||||||
writeToStream(req, request);
|
writeToStream(req, request);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
||||||
|
let socket;
|
||||||
|
|
||||||
|
request.on('socket', function (s) {
|
||||||
|
socket = s;
|
||||||
|
});
|
||||||
|
|
||||||
|
request.on('response', function (response) {
|
||||||
|
const headers = response.headers;
|
||||||
|
|
||||||
|
if (headers['transfer-encoding'] === 'chunked' && !headers['content-length']) {
|
||||||
|
response.once('close', function (hadError) {
|
||||||
|
// tests for socket presence, as in some situations the
|
||||||
|
// the 'socket' event is not triggered for the request
|
||||||
|
// (happens in deno), avoids `TypeError`
|
||||||
|
// if a data listener is still present we didn't end cleanly
|
||||||
|
const hasDataListener = socket && socket.listenerCount('data') > 0;
|
||||||
|
|
||||||
|
if (hasDataListener && !hadError) {
|
||||||
|
const err = new Error('Premature close');
|
||||||
|
err.code = 'ERR_STREAM_PREMATURE_CLOSE';
|
||||||
|
errorCallback(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function destroyStream(stream, err) {
|
||||||
|
if (stream.destroy) {
|
||||||
|
stream.destroy(err);
|
||||||
|
} else {
|
||||||
|
// node < 8
|
||||||
|
stream.emit('error', err);
|
||||||
|
stream.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect code matching
|
* Redirect code matching
|
||||||
*
|
*
|
||||||
@ -1683,4 +1772,4 @@ fetch.isRedirect = function (code) {
|
|||||||
fetch.Promise = global.Promise;
|
fetch.Promise = global.Promise;
|
||||||
|
|
||||||
export default fetch;
|
export default fetch;
|
||||||
export { Headers, Request, Response, FetchError };
|
export { Headers, Request, Response, FetchError, AbortError };
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-fetch",
|
"name": "node-fetch",
|
||||||
"version": "2.6.7",
|
"version": "2.7.0",
|
||||||
"description": "A light-weight module that brings window.fetch to node.js",
|
"description": "A light-weight module that brings window.fetch to node.js",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"browser": "./browser.js",
|
"browser": "./browser.js",
|
||||||
@ -53,7 +53,9 @@
|
|||||||
"abortcontroller-polyfill": "^1.3.0",
|
"abortcontroller-polyfill": "^1.3.0",
|
||||||
"babel-core": "^6.26.3",
|
"babel-core": "^6.26.3",
|
||||||
"babel-plugin-istanbul": "^4.1.6",
|
"babel-plugin-istanbul": "^4.1.6",
|
||||||
"babel-preset-env": "^1.6.1",
|
"babel-plugin-transform-async-generator-functions": "^6.24.1",
|
||||||
|
"babel-polyfill": "^6.26.0",
|
||||||
|
"babel-preset-env": "1.4.0",
|
||||||
"babel-register": "^6.16.3",
|
"babel-register": "^6.16.3",
|
||||||
"chai": "^3.5.0",
|
"chai": "^3.5.0",
|
||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
@ -72,5 +74,16 @@
|
|||||||
"rollup-plugin-babel": "^3.0.7",
|
"rollup-plugin-babel": "^3.0.7",
|
||||||
"string-to-arraybuffer": "^1.0.2",
|
"string-to-arraybuffer": "^1.0.2",
|
||||||
"teeny-request": "3.7.0"
|
"teeny-request": "3.7.0"
|
||||||
|
},
|
||||||
|
"release": {
|
||||||
|
"branches": [
|
||||||
|
"+([0-9]).x",
|
||||||
|
"main",
|
||||||
|
"next",
|
||||||
|
{
|
||||||
|
"name": "beta",
|
||||||
|
"prerelease": true
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
../typescript/bin/tsc
|
|
@ -1 +0,0 @@
|
|||||||
../typescript/bin/tsserver
|
|
273
npm-packages/mac-v3.4.+/.package-lock.json
generated
273
npm-packages/mac-v3.4.+/.package-lock.json
generated
@ -5,9 +5,9 @@
|
|||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"node_modules/@babel/parser": {
|
"node_modules/@babel/parser": {
|
||||||
"version": "7.20.7",
|
"version": "7.22.15",
|
||||||
"resolved": "https://registry.npmmirror.com/@babel/parser/-/parser-7.20.7.tgz",
|
"resolved": "https://registry.npmmirror.com/@babel/parser/-/parser-7.22.15.tgz",
|
||||||
"integrity": "sha512-T3Z9oHybU+0vZlY9CiDSJQTD5ZapcW18ZctFMi0MOAl/4BjFF4ul7NVSARLdbGO5vDqy9eQiGTV0LtKfvCYvcg==",
|
"integrity": "sha512-RWmQ/sklUN9BvGGpCDgSubhHWfAx24XDTDObup4ffvxaYsptOg2P3KG0j+1eWKLxpkX0j0uHxmpq2Z1SP/VhxA==",
|
||||||
"bin": {
|
"bin": {
|
||||||
"parser": "bin/babel-parser.js"
|
"parser": "bin/babel-parser.js"
|
||||||
},
|
},
|
||||||
@ -15,10 +15,15 @@
|
|||||||
"node": ">=6.0.0"
|
"node": ">=6.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@jridgewell/sourcemap-codec": {
|
||||||
|
"version": "1.4.15",
|
||||||
|
"resolved": "https://registry.npmmirror.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
|
||||||
|
"integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg=="
|
||||||
|
},
|
||||||
"node_modules/@mapbox/node-pre-gyp": {
|
"node_modules/@mapbox/node-pre-gyp": {
|
||||||
"version": "1.0.10",
|
"version": "1.0.11",
|
||||||
"resolved": "https://registry.npmmirror.com/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.10.tgz",
|
"resolved": "https://registry.npmmirror.com/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz",
|
||||||
"integrity": "sha512-4ySo4CjzStuprMwk35H5pPbkymjv1SF3jGLj6rAHp/xT/RF7TL7bd9CTm1xDY49K2qF7jmR/g7k+SkLETP6opA==",
|
"integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"detect-libc": "^2.0.0",
|
"detect-libc": "^2.0.0",
|
||||||
"https-proxy-agent": "^5.0.0",
|
"https-proxy-agent": "^5.0.0",
|
||||||
@ -45,106 +50,106 @@
|
|||||||
"integrity": "sha512-10+iaz93qR5WYxTo+PMifD5TSxiOtdRaxBf7INGGXMQgTCu8Z/7GYWYFUOS3q/G0nE5boj1r4FEB+WSy7s5gbA=="
|
"integrity": "sha512-10+iaz93qR5WYxTo+PMifD5TSxiOtdRaxBf7INGGXMQgTCu8Z/7GYWYFUOS3q/G0nE5boj1r4FEB+WSy7s5gbA=="
|
||||||
},
|
},
|
||||||
"node_modules/@vue/compiler-core": {
|
"node_modules/@vue/compiler-core": {
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"resolved": "https://registry.npmmirror.com/@vue/compiler-core/-/compiler-core-3.2.45.tgz",
|
"resolved": "https://registry.npmmirror.com/@vue/compiler-core/-/compiler-core-3.3.4.tgz",
|
||||||
"integrity": "sha512-rcMj7H+PYe5wBV3iYeUgbCglC+pbpN8hBLTJvRiK2eKQiWqu+fG9F+8sW99JdL4LQi7Re178UOxn09puSXvn4A==",
|
"integrity": "sha512-cquyDNvZ6jTbf/+x+AgM2Arrp6G4Dzbb0R64jiG804HRMfRiFXWI6kqUVqZ6ZR0bQhIoQjB4+2bhNtVwndW15g==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/parser": "^7.16.4",
|
"@babel/parser": "^7.21.3",
|
||||||
"@vue/shared": "3.2.45",
|
"@vue/shared": "3.3.4",
|
||||||
"estree-walker": "^2.0.2",
|
"estree-walker": "^2.0.2",
|
||||||
"source-map": "^0.6.1"
|
"source-map-js": "^1.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vue/compiler-dom": {
|
"node_modules/@vue/compiler-dom": {
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"resolved": "https://registry.npmmirror.com/@vue/compiler-dom/-/compiler-dom-3.2.45.tgz",
|
"resolved": "https://registry.npmmirror.com/@vue/compiler-dom/-/compiler-dom-3.3.4.tgz",
|
||||||
"integrity": "sha512-tyYeUEuKqqZO137WrZkpwfPCdiiIeXYCcJ8L4gWz9vqaxzIQRccTSwSWZ/Axx5YR2z+LvpUbmPNXxuBU45lyRw==",
|
"integrity": "sha512-wyM+OjOVpuUukIq6p5+nwHYtj9cFroz9cwkfmP9O1nzH68BenTTv0u7/ndggT8cIQlnBeOo6sUT/gvHcIkLA5w==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/compiler-core": "3.2.45",
|
"@vue/compiler-core": "3.3.4",
|
||||||
"@vue/shared": "3.2.45"
|
"@vue/shared": "3.3.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vue/compiler-sfc": {
|
"node_modules/@vue/compiler-sfc": {
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"resolved": "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-3.2.45.tgz",
|
"resolved": "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-3.3.4.tgz",
|
||||||
"integrity": "sha512-1jXDuWah1ggsnSAOGsec8cFjT/K6TMZ0sPL3o3d84Ft2AYZi2jWJgRMjw4iaK0rBfA89L5gw427H4n1RZQBu6Q==",
|
"integrity": "sha512-6y/d8uw+5TkCuzBkgLS0v3lSM3hJDntFEiUORM11pQ/hKvkhSKZrXW6i69UyXlJQisJxuUEJKAWEqWbWsLeNKQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/parser": "^7.16.4",
|
"@babel/parser": "^7.20.15",
|
||||||
"@vue/compiler-core": "3.2.45",
|
"@vue/compiler-core": "3.3.4",
|
||||||
"@vue/compiler-dom": "3.2.45",
|
"@vue/compiler-dom": "3.3.4",
|
||||||
"@vue/compiler-ssr": "3.2.45",
|
"@vue/compiler-ssr": "3.3.4",
|
||||||
"@vue/reactivity-transform": "3.2.45",
|
"@vue/reactivity-transform": "3.3.4",
|
||||||
"@vue/shared": "3.2.45",
|
"@vue/shared": "3.3.4",
|
||||||
"estree-walker": "^2.0.2",
|
"estree-walker": "^2.0.2",
|
||||||
"magic-string": "^0.25.7",
|
"magic-string": "^0.30.0",
|
||||||
"postcss": "^8.1.10",
|
"postcss": "^8.1.10",
|
||||||
"source-map": "^0.6.1"
|
"source-map-js": "^1.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vue/compiler-ssr": {
|
"node_modules/@vue/compiler-ssr": {
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"resolved": "https://registry.npmmirror.com/@vue/compiler-ssr/-/compiler-ssr-3.2.45.tgz",
|
"resolved": "https://registry.npmmirror.com/@vue/compiler-ssr/-/compiler-ssr-3.3.4.tgz",
|
||||||
"integrity": "sha512-6BRaggEGqhWht3lt24CrIbQSRD5O07MTmd+LjAn5fJj568+R9eUD2F7wMQJjX859seSlrYog7sUtrZSd7feqrQ==",
|
"integrity": "sha512-m0v6oKpup2nMSehwA6Uuu+j+wEwcy7QmwMkVNVfrV9P2qE5KshC6RwOCq8fjGS/Eak/uNb8AaWekfiXxbBB6gQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/compiler-dom": "3.2.45",
|
"@vue/compiler-dom": "3.3.4",
|
||||||
"@vue/shared": "3.2.45"
|
"@vue/shared": "3.3.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vue/reactivity": {
|
"node_modules/@vue/reactivity": {
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"resolved": "https://registry.npmmirror.com/@vue/reactivity/-/reactivity-3.2.45.tgz",
|
"resolved": "https://registry.npmmirror.com/@vue/reactivity/-/reactivity-3.3.4.tgz",
|
||||||
"integrity": "sha512-PRvhCcQcyEVohW0P8iQ7HDcIOXRjZfAsOds3N99X/Dzewy8TVhTCT4uXpAHfoKjVTJRA0O0K+6QNkDIZAxNi3A==",
|
"integrity": "sha512-kLTDLwd0B1jG08NBF3R5rqULtv/f8x3rOFByTDz4J53ttIQEDmALqKqXY0J+XQeN0aV2FBxY8nJDf88yvOPAqQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/shared": "3.2.45"
|
"@vue/shared": "3.3.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vue/reactivity-transform": {
|
"node_modules/@vue/reactivity-transform": {
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"resolved": "https://registry.npmmirror.com/@vue/reactivity-transform/-/reactivity-transform-3.2.45.tgz",
|
"resolved": "https://registry.npmmirror.com/@vue/reactivity-transform/-/reactivity-transform-3.3.4.tgz",
|
||||||
"integrity": "sha512-BHVmzYAvM7vcU5WmuYqXpwaBHjsS8T63jlKGWVtHxAHIoMIlmaMyurUSEs1Zcg46M4AYT5MtB1U274/2aNzjJQ==",
|
"integrity": "sha512-MXgwjako4nu5WFLAjpBnCj/ieqcjE2aJBINUNQzkZQfzIZA4xn+0fV1tIYBJvvva3N3OvKGofRLvQIwEQPpaXw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/parser": "^7.16.4",
|
"@babel/parser": "^7.20.15",
|
||||||
"@vue/compiler-core": "3.2.45",
|
"@vue/compiler-core": "3.3.4",
|
||||||
"@vue/shared": "3.2.45",
|
"@vue/shared": "3.3.4",
|
||||||
"estree-walker": "^2.0.2",
|
"estree-walker": "^2.0.2",
|
||||||
"magic-string": "^0.25.7"
|
"magic-string": "^0.30.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vue/runtime-core": {
|
"node_modules/@vue/runtime-core": {
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"resolved": "https://registry.npmmirror.com/@vue/runtime-core/-/runtime-core-3.2.45.tgz",
|
"resolved": "https://registry.npmmirror.com/@vue/runtime-core/-/runtime-core-3.3.4.tgz",
|
||||||
"integrity": "sha512-gzJiTA3f74cgARptqzYswmoQx0fIA+gGYBfokYVhF8YSXjWTUA2SngRzZRku2HbGbjzB6LBYSbKGIaK8IW+s0A==",
|
"integrity": "sha512-R+bqxMN6pWO7zGI4OMlmvePOdP2c93GsHFM/siJI7O2nxFRzj55pLwkpCedEY+bTMgp5miZ8CxfIZo3S+gFqvA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/reactivity": "3.2.45",
|
"@vue/reactivity": "3.3.4",
|
||||||
"@vue/shared": "3.2.45"
|
"@vue/shared": "3.3.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vue/runtime-dom": {
|
"node_modules/@vue/runtime-dom": {
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"resolved": "https://registry.npmmirror.com/@vue/runtime-dom/-/runtime-dom-3.2.45.tgz",
|
"resolved": "https://registry.npmmirror.com/@vue/runtime-dom/-/runtime-dom-3.3.4.tgz",
|
||||||
"integrity": "sha512-cy88YpfP5Ue2bDBbj75Cb4bIEZUMM/mAkDMfqDTpUYVgTf/kuQ2VQ8LebuZ8k6EudgH8pYhsGWHlY0lcxlvTwA==",
|
"integrity": "sha512-Aj5bTJ3u5sFsUckRghsNjVTtxZQ1OyMWCr5dZRAPijF/0Vy4xEoRCwLyHXcj4D0UFbJ4lbx3gPTgg06K/GnPnQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/runtime-core": "3.2.45",
|
"@vue/runtime-core": "3.3.4",
|
||||||
"@vue/shared": "3.2.45",
|
"@vue/shared": "3.3.4",
|
||||||
"csstype": "^2.6.8"
|
"csstype": "^3.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vue/server-renderer": {
|
"node_modules/@vue/server-renderer": {
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"resolved": "https://registry.npmmirror.com/@vue/server-renderer/-/server-renderer-3.2.45.tgz",
|
"resolved": "https://registry.npmmirror.com/@vue/server-renderer/-/server-renderer-3.3.4.tgz",
|
||||||
"integrity": "sha512-ebiMq7q24WBU1D6uhPK//2OTR1iRIyxjF5iVq/1a5I1SDMDyDu4Ts6fJaMnjrvD3MqnaiFkKQj+LKAgz5WIK3g==",
|
"integrity": "sha512-Q6jDDzR23ViIb67v+vM1Dqntu+HUexQcsWKhhQa4ARVzxOY2HbC7QRW/ggkDBd5BU+uM1sV6XOAP0b216o34JQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/compiler-ssr": "3.2.45",
|
"@vue/compiler-ssr": "3.3.4",
|
||||||
"@vue/shared": "3.2.45"
|
"@vue/shared": "3.3.4"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"vue": "3.2.45"
|
"vue": "3.3.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vue/shared": {
|
"node_modules/@vue/shared": {
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.2.45.tgz",
|
"resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.3.4.tgz",
|
||||||
"integrity": "sha512-Ewzq5Yhimg7pSztDV+RH1UDKBzmtqieXQlpTVm2AwraoRL/Rks96mvd8Vgi7Lj+h+TH8dv7mXD3FRZR3TUvbSg=="
|
"integrity": "sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ=="
|
||||||
},
|
},
|
||||||
"node_modules/abbrev": {
|
"node_modules/abbrev": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
@ -152,14 +157,14 @@
|
|||||||
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
|
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
|
||||||
},
|
},
|
||||||
"node_modules/ag-psd": {
|
"node_modules/ag-psd": {
|
||||||
"version": "15.0.1",
|
"version": "15.3.1",
|
||||||
"resolved": "https://registry.npmmirror.com/ag-psd/-/ag-psd-15.0.1.tgz",
|
"resolved": "https://registry.npmmirror.com/ag-psd/-/ag-psd-15.3.1.tgz",
|
||||||
"integrity": "sha512-uKogYrQz6Tv/9mfSUlJPIZFySWU/KuCdmM6VAUpOdLmM98yQPkEtLz5R4W7aq/DHbumxASrkznJwrX2Tp+KMrA==",
|
"integrity": "sha512-woH/Yb5OduYCvwH2OPLeqSPaWTmgT3n8WYU1/csuUX/BAUSphqH0B/QdRnBvlW7C+53VIH8c3Mm4GErjQx+L3A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/base64-js": "^1.3.0",
|
"@types/base64-js": "^1.3.0",
|
||||||
"@types/pako": "^2.0.0",
|
"@types/pako": "^2.0.0",
|
||||||
"base64-js": "^1.5.1",
|
"base64-js": "^1.5.1",
|
||||||
"pako": "^2.0.4"
|
"pako": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/agent-base": {
|
"node_modules/agent-base": {
|
||||||
@ -218,9 +223,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/canvas": {
|
"node_modules/canvas": {
|
||||||
"version": "2.11.0",
|
"version": "2.11.2",
|
||||||
"resolved": "https://registry.npmmirror.com/canvas/-/canvas-2.11.0.tgz",
|
"resolved": "https://registry.npmmirror.com/canvas/-/canvas-2.11.2.tgz",
|
||||||
"integrity": "sha512-bdTjFexjKJEwtIo0oRx8eD4G2yWoUOXP9lj279jmQ2zMnTQhT8C3512OKz3s+ZOaQlLbE7TuVvRDYDB3Llyy5g==",
|
"integrity": "sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mapbox/node-pre-gyp": "^1.0.0",
|
"@mapbox/node-pre-gyp": "^1.0.0",
|
||||||
@ -258,9 +263,9 @@
|
|||||||
"integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ=="
|
"integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ=="
|
||||||
},
|
},
|
||||||
"node_modules/csstype": {
|
"node_modules/csstype": {
|
||||||
"version": "2.6.21",
|
"version": "3.1.2",
|
||||||
"resolved": "https://registry.npmmirror.com/csstype/-/csstype-2.6.21.tgz",
|
"resolved": "https://registry.npmmirror.com/csstype/-/csstype-3.1.2.tgz",
|
||||||
"integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w=="
|
"integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ=="
|
||||||
},
|
},
|
||||||
"node_modules/debug": {
|
"node_modules/debug": {
|
||||||
"version": "4.3.4",
|
"version": "4.3.4",
|
||||||
@ -295,9 +300,9 @@
|
|||||||
"integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ=="
|
"integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ=="
|
||||||
},
|
},
|
||||||
"node_modules/detect-libc": {
|
"node_modules/detect-libc": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-2.0.1.tgz",
|
"resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-2.0.2.tgz",
|
||||||
"integrity": "sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==",
|
"integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
@ -388,9 +393,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/graceful-fs": {
|
"node_modules/graceful-fs": {
|
||||||
"version": "4.2.10",
|
"version": "4.2.11",
|
||||||
"resolved": "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.10.tgz",
|
"resolved": "https://registry.npmmirror.com/graceful-fs/-/graceful-fs-4.2.11.tgz",
|
||||||
"integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA=="
|
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="
|
||||||
},
|
},
|
||||||
"node_modules/has-unicode": {
|
"node_modules/has-unicode": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
@ -454,11 +459,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/magic-string": {
|
"node_modules/magic-string": {
|
||||||
"version": "0.25.9",
|
"version": "0.30.3",
|
||||||
"resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.25.9.tgz",
|
"resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.30.3.tgz",
|
||||||
"integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==",
|
"integrity": "sha512-B7xGbll2fG/VjP+SWg4sX3JynwIU0mjoTc6MPpKNuIvftk6u6vqhDnk1R80b8C2GBR6ywqy+1DcKBrevBg+bmw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"sourcemap-codec": "^1.4.8"
|
"@jridgewell/sourcemap-codec": "^1.4.15"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/make-dir": {
|
"node_modules/make-dir": {
|
||||||
@ -473,9 +481,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/make-dir/node_modules/semver": {
|
"node_modules/make-dir/node_modules/semver": {
|
||||||
"version": "6.3.0",
|
"version": "6.3.1",
|
||||||
"resolved": "https://registry.npmmirror.com/semver/-/semver-6.3.0.tgz",
|
"resolved": "https://registry.npmmirror.com/semver/-/semver-6.3.1.tgz",
|
||||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
|
||||||
"bin": {
|
"bin": {
|
||||||
"semver": "bin/semver.js"
|
"semver": "bin/semver.js"
|
||||||
}
|
}
|
||||||
@ -500,17 +508,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/minimist": {
|
"node_modules/minimist": {
|
||||||
"version": "1.2.7",
|
"version": "1.2.8",
|
||||||
"resolved": "https://registry.npmmirror.com/minimist/-/minimist-1.2.7.tgz",
|
"resolved": "https://registry.npmmirror.com/minimist/-/minimist-1.2.8.tgz",
|
||||||
"integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g=="
|
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="
|
||||||
},
|
},
|
||||||
"node_modules/minipass": {
|
"node_modules/minipass": {
|
||||||
"version": "4.0.0",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmmirror.com/minipass/-/minipass-4.0.0.tgz",
|
"resolved": "https://registry.npmmirror.com/minipass/-/minipass-5.0.0.tgz",
|
||||||
"integrity": "sha512-g2Uuh2jEKoht+zvO6vJqXmYpflPqzRBT+Th2h01DKh5z7wbY/AZ2gCQ78cP70YoHPyFdY30YBV5WxgLOEwOykw==",
|
"integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
|
||||||
"dependencies": {
|
|
||||||
"yallist": "^4.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
@ -560,9 +565,9 @@
|
|||||||
"integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ=="
|
"integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ=="
|
||||||
},
|
},
|
||||||
"node_modules/nanoid": {
|
"node_modules/nanoid": {
|
||||||
"version": "3.3.4",
|
"version": "3.3.6",
|
||||||
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.4.tgz",
|
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.6.tgz",
|
||||||
"integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==",
|
"integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==",
|
||||||
"bin": {
|
"bin": {
|
||||||
"nanoid": "bin/nanoid.cjs"
|
"nanoid": "bin/nanoid.cjs"
|
||||||
},
|
},
|
||||||
@ -571,9 +576,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/node-fetch": {
|
"node_modules/node-fetch": {
|
||||||
"version": "2.6.7",
|
"version": "2.7.0",
|
||||||
"resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.6.7.tgz",
|
"resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||||
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"whatwg-url": "^5.0.0"
|
"whatwg-url": "^5.0.0"
|
||||||
},
|
},
|
||||||
@ -649,16 +654,16 @@
|
|||||||
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ=="
|
"integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ=="
|
||||||
},
|
},
|
||||||
"node_modules/pinyin-pro": {
|
"node_modules/pinyin-pro": {
|
||||||
"version": "3.16.0",
|
"version": "3.16.4",
|
||||||
"resolved": "https://registry.npmmirror.com/pinyin-pro/-/pinyin-pro-3.16.0.tgz",
|
"resolved": "https://registry.npmmirror.com/pinyin-pro/-/pinyin-pro-3.16.4.tgz",
|
||||||
"integrity": "sha512-U4pMQ/KSMM5JmSb+ZcReCIbgzGl/JaglaHqWjCli0hpA0rDdjRbAO67e6fOa3ZFcJzbqfe6bJkaMMmpiWmkXgQ=="
|
"integrity": "sha512-NP1x+Z9OajEIjJzIs5gzp3DHiUln8SLIytoYspPFQ8Xd6NMBO2HHZuki1XgYzGS7qat4oRZlwnZ+hvCZwuldbg=="
|
||||||
},
|
},
|
||||||
"node_modules/postcss": {
|
"node_modules/postcss": {
|
||||||
"version": "8.4.20",
|
"version": "8.4.29",
|
||||||
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.20.tgz",
|
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.29.tgz",
|
||||||
"integrity": "sha512-6Q04AXR1212bXr5fh03u8aAwbLxAQNGQ/Q1LNa0VfOI06ZAlhPHtQvE4OIdpj4kLThXilalPnmDSOD65DcHt+g==",
|
"integrity": "sha512-cbI+jaqIeu/VGqXEarWkRCCffhjgXc0qjBtXpqJhTBohMUjUQnbBr0xqX3vEKudc4iviTewcJo5ajcec5+wdJw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanoid": "^3.3.4",
|
"nanoid": "^3.3.6",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
"source-map-js": "^1.0.2"
|
"source-map-js": "^1.0.2"
|
||||||
},
|
},
|
||||||
@ -667,9 +672,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/readable-stream": {
|
"node_modules/readable-stream": {
|
||||||
"version": "3.6.0",
|
"version": "3.6.2",
|
||||||
"resolved": "https://registry.npmmirror.com/readable-stream/-/readable-stream-3.6.0.tgz",
|
"resolved": "https://registry.npmmirror.com/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"inherits": "^2.0.3",
|
"inherits": "^2.0.3",
|
||||||
"string_decoder": "^1.1.1",
|
"string_decoder": "^1.1.1",
|
||||||
@ -696,9 +701,9 @@
|
|||||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||||
},
|
},
|
||||||
"node_modules/semver": {
|
"node_modules/semver": {
|
||||||
"version": "7.3.8",
|
"version": "7.5.4",
|
||||||
"resolved": "https://registry.npmmirror.com/semver/-/semver-7.3.8.tgz",
|
"resolved": "https://registry.npmmirror.com/semver/-/semver-7.5.4.tgz",
|
||||||
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
|
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lru-cache": "^6.0.0"
|
"lru-cache": "^6.0.0"
|
||||||
},
|
},
|
||||||
@ -734,14 +739,6 @@
|
|||||||
"simple-concat": "^1.0.0"
|
"simple-concat": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/source-map": {
|
|
||||||
"version": "0.6.1",
|
|
||||||
"resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz",
|
|
||||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.10.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/source-map-js": {
|
"node_modules/source-map-js": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.0.2.tgz",
|
"resolved": "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.0.2.tgz",
|
||||||
@ -750,12 +747,6 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/sourcemap-codec": {
|
|
||||||
"version": "1.4.8",
|
|
||||||
"resolved": "https://registry.npmmirror.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
|
|
||||||
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
|
|
||||||
"deprecated": "Please use @jridgewell/sourcemap-codec instead"
|
|
||||||
},
|
|
||||||
"node_modules/string_decoder": {
|
"node_modules/string_decoder": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.3.0.tgz",
|
"resolved": "https://registry.npmmirror.com/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||||
@ -789,13 +780,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/tar": {
|
"node_modules/tar": {
|
||||||
"version": "6.1.13",
|
"version": "6.2.0",
|
||||||
"resolved": "https://registry.npmmirror.com/tar/-/tar-6.1.13.tgz",
|
"resolved": "https://registry.npmmirror.com/tar/-/tar-6.2.0.tgz",
|
||||||
"integrity": "sha512-jdIBIN6LTIe2jqzay/2vtYLlBHa3JF42ot3h1dW8Q0PaAG4v8rm0cvpVePtau5C6OKXGGcgO9q2AMNSWxiLqKw==",
|
"integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chownr": "^2.0.0",
|
"chownr": "^2.0.0",
|
||||||
"fs-minipass": "^2.0.0",
|
"fs-minipass": "^2.0.0",
|
||||||
"minipass": "^4.0.0",
|
"minipass": "^5.0.0",
|
||||||
"minizlib": "^2.1.1",
|
"minizlib": "^2.1.1",
|
||||||
"mkdirp": "^1.0.3",
|
"mkdirp": "^1.0.3",
|
||||||
"yallist": "^4.0.0"
|
"yallist": "^4.0.0"
|
||||||
@ -823,15 +814,15 @@
|
|||||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
||||||
},
|
},
|
||||||
"node_modules/vue": {
|
"node_modules/vue": {
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"resolved": "https://registry.npmmirror.com/vue/-/vue-3.2.45.tgz",
|
"resolved": "https://registry.npmmirror.com/vue/-/vue-3.3.4.tgz",
|
||||||
"integrity": "sha512-9Nx/Mg2b2xWlXykmCwiTUCWHbWIj53bnkizBxKai1g61f2Xit700A1ljowpTIM11e3uipOeiPcSqnmBg6gyiaA==",
|
"integrity": "sha512-VTyEYn3yvIeY1Py0WaYGZsXnz3y5UnGi62GjVEqvEGPl6nxbOrCXbVOTQWBEJUqAyTUk2uJ5JLVnYJ6ZzGbrSw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/compiler-dom": "3.2.45",
|
"@vue/compiler-dom": "3.3.4",
|
||||||
"@vue/compiler-sfc": "3.2.45",
|
"@vue/compiler-sfc": "3.3.4",
|
||||||
"@vue/runtime-dom": "3.2.45",
|
"@vue/runtime-dom": "3.3.4",
|
||||||
"@vue/server-renderer": "3.2.45",
|
"@vue/server-renderer": "3.3.4",
|
||||||
"@vue/shared": "3.2.45"
|
"@vue/shared": "3.3.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/webidl-conversions": {
|
"node_modules/webidl-conversions": {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
> A JavaScript parser
|
> A JavaScript parser
|
||||||
|
|
||||||
See our website [@babel/parser](https://babeljs.io/docs/en/babel-parser) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20parser%20(babylon)%22+is%3Aopen) associated with this package.
|
See our website [@babel/parser](https://babeljs.io/docs/babel-parser) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20parser%22+is%3Aopen) associated with this package.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@babel/parser",
|
"name": "@babel/parser",
|
||||||
"version": "7.20.7",
|
"version": "7.22.15",
|
||||||
"description": "A JavaScript parser",
|
"description": "A JavaScript parser",
|
||||||
"author": "The Babel Team (https://babel.dev/team)",
|
"author": "The Babel Team (https://babel.dev/team)",
|
||||||
"homepage": "https://babel.dev/docs/en/next/babel-parser",
|
"homepage": "https://babel.dev/docs/en/next/babel-parser",
|
||||||
@ -34,11 +34,11 @@
|
|||||||
"node": ">=6.0.0"
|
"node": ">=6.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/code-frame": "^7.18.6",
|
"@babel/code-frame": "^7.22.13",
|
||||||
"@babel/helper-check-duplicate-nodes": "^7.18.6",
|
"@babel/helper-check-duplicate-nodes": "^7.22.5",
|
||||||
"@babel/helper-fixtures": "^7.19.4",
|
"@babel/helper-fixtures": "^7.22.13",
|
||||||
"@babel/helper-string-parser": "^7.19.4",
|
"@babel/helper-string-parser": "^7.22.5",
|
||||||
"@babel/helper-validator-identifier": "^7.19.1",
|
"@babel/helper-validator-identifier": "^7.22.15",
|
||||||
"charcodes": "^0.2.0"
|
"charcodes": "^0.2.0"
|
||||||
},
|
},
|
||||||
"bin": "./bin/babel-parser.js",
|
"bin": "./bin/babel-parser.js",
|
||||||
|
@ -26,7 +26,8 @@ type Plugin =
|
|||||||
| "importMeta"
|
| "importMeta"
|
||||||
| "jsx"
|
| "jsx"
|
||||||
| "logicalAssignment"
|
| "logicalAssignment"
|
||||||
| "importAssertions"
|
| "importAssertions" // deprecated
|
||||||
|
| "importAttributes"
|
||||||
| "importReflection"
|
| "importReflection"
|
||||||
| "moduleBlocks"
|
| "moduleBlocks"
|
||||||
| "moduleStringNames"
|
| "moduleStringNames"
|
||||||
@ -38,7 +39,7 @@ type Plugin =
|
|||||||
| "partialApplication"
|
| "partialApplication"
|
||||||
| "placeholders"
|
| "placeholders"
|
||||||
| "privateIn" // Enabled by default
|
| "privateIn" // Enabled by default
|
||||||
| "regexpUnicodeSets"
|
| "regexpUnicodeSets" // Enabled by default
|
||||||
| "throwExpressions"
|
| "throwExpressions"
|
||||||
| "topLevelAwait"
|
| "topLevelAwait"
|
||||||
| "v8intrinsic"
|
| "v8intrinsic"
|
||||||
@ -47,6 +48,7 @@ type Plugin =
|
|||||||
type ParserPluginWithOptions =
|
type ParserPluginWithOptions =
|
||||||
| ["decorators", DecoratorsPluginOptions]
|
| ["decorators", DecoratorsPluginOptions]
|
||||||
| ["estree", { classFeatures?: boolean }]
|
| ["estree", { classFeatures?: boolean }]
|
||||||
|
| ["importAttributes", { deprecatedAssertSyntax: boolean }]
|
||||||
// @deprecated
|
// @deprecated
|
||||||
| ["moduleAttributes", { version: "may-2020" }]
|
| ["moduleAttributes", { version: "may-2020" }]
|
||||||
| ["pipelineOperator", PipelineOperatorPluginOptions]
|
| ["pipelineOperator", PipelineOperatorPluginOptions]
|
||||||
@ -122,6 +124,12 @@ interface ParserOptions {
|
|||||||
*/
|
*/
|
||||||
allowReturnOutsideFunction?: boolean;
|
allowReturnOutsideFunction?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By default, new.target use is not allowed outside of a function or class.
|
||||||
|
* Set this to true to accept such code.
|
||||||
|
*/
|
||||||
|
allowNewTargetOutsideFunction?: boolean;
|
||||||
|
|
||||||
allowSuperOutsideMethod?: boolean;
|
allowSuperOutsideMethod?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -130,6 +138,12 @@ interface ParserOptions {
|
|||||||
*/
|
*/
|
||||||
allowUndeclaredExports?: boolean;
|
allowUndeclaredExports?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By default, Babel parser JavaScript code according to Annex B syntax.
|
||||||
|
* Set this to `false` to disable such behavior.
|
||||||
|
*/
|
||||||
|
annexB?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* By default, Babel attaches comments to adjacent AST nodes.
|
* By default, Babel attaches comments to adjacent AST nodes.
|
||||||
* When this option is set to false, comments are not attached.
|
* When this option is set to false, comments are not attached.
|
||||||
|
200
npm-packages/mac-v3.4.+/@jridgewell/sourcemap-codec/README.md
Normal file
200
npm-packages/mac-v3.4.+/@jridgewell/sourcemap-codec/README.md
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
# @jridgewell/sourcemap-codec
|
||||||
|
|
||||||
|
Encode/decode the `mappings` property of a [sourcemap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit).
|
||||||
|
|
||||||
|
|
||||||
|
## Why?
|
||||||
|
|
||||||
|
Sourcemaps are difficult to generate and manipulate, because the `mappings` property – the part that actually links the generated code back to the original source – is encoded using an obscure method called [Variable-length quantity](https://en.wikipedia.org/wiki/Variable-length_quantity). On top of that, each segment in the mapping contains offsets rather than absolute indices, which means that you can't look at a segment in isolation – you have to understand the whole sourcemap.
|
||||||
|
|
||||||
|
This package makes the process slightly easier.
|
||||||
|
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install @jridgewell/sourcemap-codec
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { encode, decode } from '@jridgewell/sourcemap-codec';
|
||||||
|
|
||||||
|
var decoded = decode( ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' );
|
||||||
|
|
||||||
|
assert.deepEqual( decoded, [
|
||||||
|
// the first line (of the generated code) has no mappings,
|
||||||
|
// as shown by the starting semi-colon (which separates lines)
|
||||||
|
[],
|
||||||
|
|
||||||
|
// the second line contains four (comma-separated) segments
|
||||||
|
[
|
||||||
|
// segments are encoded as you'd expect:
|
||||||
|
// [ generatedCodeColumn, sourceIndex, sourceCodeLine, sourceCodeColumn, nameIndex ]
|
||||||
|
|
||||||
|
// i.e. the first segment begins at column 2, and maps back to the second column
|
||||||
|
// of the second line (both zero-based) of the 0th source, and uses the 0th
|
||||||
|
// name in the `map.names` array
|
||||||
|
[ 2, 0, 2, 2, 0 ],
|
||||||
|
|
||||||
|
// the remaining segments are 4-length rather than 5-length,
|
||||||
|
// because they don't map a name
|
||||||
|
[ 4, 0, 2, 4 ],
|
||||||
|
[ 6, 0, 2, 5 ],
|
||||||
|
[ 7, 0, 2, 7 ]
|
||||||
|
],
|
||||||
|
|
||||||
|
// the final line contains two segments
|
||||||
|
[
|
||||||
|
[ 2, 1, 10, 19 ],
|
||||||
|
[ 12, 1, 11, 20 ]
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
var encoded = encode( decoded );
|
||||||
|
assert.equal( encoded, ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' );
|
||||||
|
```
|
||||||
|
|
||||||
|
## Benchmarks
|
||||||
|
|
||||||
|
```
|
||||||
|
node v18.0.0
|
||||||
|
|
||||||
|
amp.js.map - 45120 segments
|
||||||
|
|
||||||
|
Decode Memory Usage:
|
||||||
|
@jridgewell/sourcemap-codec 5479160 bytes
|
||||||
|
sourcemap-codec 5659336 bytes
|
||||||
|
source-map-0.6.1 17144440 bytes
|
||||||
|
source-map-0.8.0 6867424 bytes
|
||||||
|
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||||
|
|
||||||
|
Decode speed:
|
||||||
|
decode: @jridgewell/sourcemap-codec x 502 ops/sec ±1.03% (90 runs sampled)
|
||||||
|
decode: sourcemap-codec x 445 ops/sec ±0.97% (92 runs sampled)
|
||||||
|
decode: source-map-0.6.1 x 36.01 ops/sec ±1.64% (49 runs sampled)
|
||||||
|
decode: source-map-0.8.0 x 367 ops/sec ±0.04% (95 runs sampled)
|
||||||
|
Fastest is decode: @jridgewell/sourcemap-codec
|
||||||
|
|
||||||
|
Encode Memory Usage:
|
||||||
|
@jridgewell/sourcemap-codec 1261620 bytes
|
||||||
|
sourcemap-codec 9119248 bytes
|
||||||
|
source-map-0.6.1 8968560 bytes
|
||||||
|
source-map-0.8.0 8952952 bytes
|
||||||
|
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||||
|
|
||||||
|
Encode speed:
|
||||||
|
encode: @jridgewell/sourcemap-codec x 738 ops/sec ±0.42% (98 runs sampled)
|
||||||
|
encode: sourcemap-codec x 238 ops/sec ±0.73% (88 runs sampled)
|
||||||
|
encode: source-map-0.6.1 x 162 ops/sec ±0.43% (84 runs sampled)
|
||||||
|
encode: source-map-0.8.0 x 191 ops/sec ±0.34% (90 runs sampled)
|
||||||
|
Fastest is encode: @jridgewell/sourcemap-codec
|
||||||
|
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
|
||||||
|
babel.min.js.map - 347793 segments
|
||||||
|
|
||||||
|
Decode Memory Usage:
|
||||||
|
@jridgewell/sourcemap-codec 35338184 bytes
|
||||||
|
sourcemap-codec 35922736 bytes
|
||||||
|
source-map-0.6.1 62366360 bytes
|
||||||
|
source-map-0.8.0 44337416 bytes
|
||||||
|
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||||
|
|
||||||
|
Decode speed:
|
||||||
|
decode: @jridgewell/sourcemap-codec x 40.35 ops/sec ±4.47% (54 runs sampled)
|
||||||
|
decode: sourcemap-codec x 36.76 ops/sec ±3.67% (51 runs sampled)
|
||||||
|
decode: source-map-0.6.1 x 4.44 ops/sec ±2.15% (16 runs sampled)
|
||||||
|
decode: source-map-0.8.0 x 59.35 ops/sec ±0.05% (78 runs sampled)
|
||||||
|
Fastest is decode: source-map-0.8.0
|
||||||
|
|
||||||
|
Encode Memory Usage:
|
||||||
|
@jridgewell/sourcemap-codec 7212604 bytes
|
||||||
|
sourcemap-codec 21421456 bytes
|
||||||
|
source-map-0.6.1 25286888 bytes
|
||||||
|
source-map-0.8.0 25498744 bytes
|
||||||
|
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||||
|
|
||||||
|
Encode speed:
|
||||||
|
encode: @jridgewell/sourcemap-codec x 112 ops/sec ±0.13% (84 runs sampled)
|
||||||
|
encode: sourcemap-codec x 30.23 ops/sec ±2.76% (53 runs sampled)
|
||||||
|
encode: source-map-0.6.1 x 19.43 ops/sec ±3.70% (37 runs sampled)
|
||||||
|
encode: source-map-0.8.0 x 19.40 ops/sec ±3.26% (37 runs sampled)
|
||||||
|
Fastest is encode: @jridgewell/sourcemap-codec
|
||||||
|
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
|
||||||
|
preact.js.map - 1992 segments
|
||||||
|
|
||||||
|
Decode Memory Usage:
|
||||||
|
@jridgewell/sourcemap-codec 500272 bytes
|
||||||
|
sourcemap-codec 516864 bytes
|
||||||
|
source-map-0.6.1 1596672 bytes
|
||||||
|
source-map-0.8.0 517272 bytes
|
||||||
|
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||||
|
|
||||||
|
Decode speed:
|
||||||
|
decode: @jridgewell/sourcemap-codec x 16,137 ops/sec ±0.17% (99 runs sampled)
|
||||||
|
decode: sourcemap-codec x 12,139 ops/sec ±0.13% (99 runs sampled)
|
||||||
|
decode: source-map-0.6.1 x 1,264 ops/sec ±0.12% (100 runs sampled)
|
||||||
|
decode: source-map-0.8.0 x 9,894 ops/sec ±0.08% (101 runs sampled)
|
||||||
|
Fastest is decode: @jridgewell/sourcemap-codec
|
||||||
|
|
||||||
|
Encode Memory Usage:
|
||||||
|
@jridgewell/sourcemap-codec 321026 bytes
|
||||||
|
sourcemap-codec 830832 bytes
|
||||||
|
source-map-0.6.1 586608 bytes
|
||||||
|
source-map-0.8.0 586680 bytes
|
||||||
|
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||||
|
|
||||||
|
Encode speed:
|
||||||
|
encode: @jridgewell/sourcemap-codec x 19,876 ops/sec ±0.78% (95 runs sampled)
|
||||||
|
encode: sourcemap-codec x 6,983 ops/sec ±0.15% (100 runs sampled)
|
||||||
|
encode: source-map-0.6.1 x 5,070 ops/sec ±0.12% (102 runs sampled)
|
||||||
|
encode: source-map-0.8.0 x 5,641 ops/sec ±0.17% (100 runs sampled)
|
||||||
|
Fastest is encode: @jridgewell/sourcemap-codec
|
||||||
|
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
|
||||||
|
react.js.map - 5726 segments
|
||||||
|
|
||||||
|
Decode Memory Usage:
|
||||||
|
@jridgewell/sourcemap-codec 734848 bytes
|
||||||
|
sourcemap-codec 954200 bytes
|
||||||
|
source-map-0.6.1 2276432 bytes
|
||||||
|
source-map-0.8.0 955488 bytes
|
||||||
|
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||||
|
|
||||||
|
Decode speed:
|
||||||
|
decode: @jridgewell/sourcemap-codec x 5,723 ops/sec ±0.12% (98 runs sampled)
|
||||||
|
decode: sourcemap-codec x 4,555 ops/sec ±0.09% (101 runs sampled)
|
||||||
|
decode: source-map-0.6.1 x 437 ops/sec ±0.11% (93 runs sampled)
|
||||||
|
decode: source-map-0.8.0 x 3,441 ops/sec ±0.15% (100 runs sampled)
|
||||||
|
Fastest is decode: @jridgewell/sourcemap-codec
|
||||||
|
|
||||||
|
Encode Memory Usage:
|
||||||
|
@jridgewell/sourcemap-codec 638672 bytes
|
||||||
|
sourcemap-codec 1109840 bytes
|
||||||
|
source-map-0.6.1 1321224 bytes
|
||||||
|
source-map-0.8.0 1324448 bytes
|
||||||
|
Smallest memory usage is @jridgewell/sourcemap-codec
|
||||||
|
|
||||||
|
Encode speed:
|
||||||
|
encode: @jridgewell/sourcemap-codec x 6,801 ops/sec ±0.48% (98 runs sampled)
|
||||||
|
encode: sourcemap-codec x 2,533 ops/sec ±0.13% (101 runs sampled)
|
||||||
|
encode: source-map-0.6.1 x 2,248 ops/sec ±0.08% (100 runs sampled)
|
||||||
|
encode: source-map-0.8.0 x 2,303 ops/sec ±0.15% (100 runs sampled)
|
||||||
|
Fastest is encode: @jridgewell/sourcemap-codec
|
||||||
|
```
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
MIT
|
164
npm-packages/mac-v3.4.+/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
vendored
Normal file
164
npm-packages/mac-v3.4.+/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
vendored
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
const comma = ','.charCodeAt(0);
|
||||||
|
const semicolon = ';'.charCodeAt(0);
|
||||||
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||||
|
const intToChar = new Uint8Array(64); // 64 possible chars.
|
||||||
|
const charToInt = new Uint8Array(128); // z is 122 in ASCII
|
||||||
|
for (let i = 0; i < chars.length; i++) {
|
||||||
|
const c = chars.charCodeAt(i);
|
||||||
|
intToChar[i] = c;
|
||||||
|
charToInt[c] = i;
|
||||||
|
}
|
||||||
|
// Provide a fallback for older environments.
|
||||||
|
const td = typeof TextDecoder !== 'undefined'
|
||||||
|
? /* #__PURE__ */ new TextDecoder()
|
||||||
|
: typeof Buffer !== 'undefined'
|
||||||
|
? {
|
||||||
|
decode(buf) {
|
||||||
|
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
||||||
|
return out.toString();
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
decode(buf) {
|
||||||
|
let out = '';
|
||||||
|
for (let i = 0; i < buf.length; i++) {
|
||||||
|
out += String.fromCharCode(buf[i]);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
function decode(mappings) {
|
||||||
|
const state = new Int32Array(5);
|
||||||
|
const decoded = [];
|
||||||
|
let index = 0;
|
||||||
|
do {
|
||||||
|
const semi = indexOf(mappings, index);
|
||||||
|
const line = [];
|
||||||
|
let sorted = true;
|
||||||
|
let lastCol = 0;
|
||||||
|
state[0] = 0;
|
||||||
|
for (let i = index; i < semi; i++) {
|
||||||
|
let seg;
|
||||||
|
i = decodeInteger(mappings, i, state, 0); // genColumn
|
||||||
|
const col = state[0];
|
||||||
|
if (col < lastCol)
|
||||||
|
sorted = false;
|
||||||
|
lastCol = col;
|
||||||
|
if (hasMoreVlq(mappings, i, semi)) {
|
||||||
|
i = decodeInteger(mappings, i, state, 1); // sourcesIndex
|
||||||
|
i = decodeInteger(mappings, i, state, 2); // sourceLine
|
||||||
|
i = decodeInteger(mappings, i, state, 3); // sourceColumn
|
||||||
|
if (hasMoreVlq(mappings, i, semi)) {
|
||||||
|
i = decodeInteger(mappings, i, state, 4); // namesIndex
|
||||||
|
seg = [col, state[1], state[2], state[3], state[4]];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
seg = [col, state[1], state[2], state[3]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
seg = [col];
|
||||||
|
}
|
||||||
|
line.push(seg);
|
||||||
|
}
|
||||||
|
if (!sorted)
|
||||||
|
sort(line);
|
||||||
|
decoded.push(line);
|
||||||
|
index = semi + 1;
|
||||||
|
} while (index <= mappings.length);
|
||||||
|
return decoded;
|
||||||
|
}
|
||||||
|
function indexOf(mappings, index) {
|
||||||
|
const idx = mappings.indexOf(';', index);
|
||||||
|
return idx === -1 ? mappings.length : idx;
|
||||||
|
}
|
||||||
|
function decodeInteger(mappings, pos, state, j) {
|
||||||
|
let value = 0;
|
||||||
|
let shift = 0;
|
||||||
|
let integer = 0;
|
||||||
|
do {
|
||||||
|
const c = mappings.charCodeAt(pos++);
|
||||||
|
integer = charToInt[c];
|
||||||
|
value |= (integer & 31) << shift;
|
||||||
|
shift += 5;
|
||||||
|
} while (integer & 32);
|
||||||
|
const shouldNegate = value & 1;
|
||||||
|
value >>>= 1;
|
||||||
|
if (shouldNegate) {
|
||||||
|
value = -0x80000000 | -value;
|
||||||
|
}
|
||||||
|
state[j] += value;
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
function hasMoreVlq(mappings, i, length) {
|
||||||
|
if (i >= length)
|
||||||
|
return false;
|
||||||
|
return mappings.charCodeAt(i) !== comma;
|
||||||
|
}
|
||||||
|
function sort(line) {
|
||||||
|
line.sort(sortComparator);
|
||||||
|
}
|
||||||
|
function sortComparator(a, b) {
|
||||||
|
return a[0] - b[0];
|
||||||
|
}
|
||||||
|
function encode(decoded) {
|
||||||
|
const state = new Int32Array(5);
|
||||||
|
const bufLength = 1024 * 16;
|
||||||
|
const subLength = bufLength - 36;
|
||||||
|
const buf = new Uint8Array(bufLength);
|
||||||
|
const sub = buf.subarray(0, subLength);
|
||||||
|
let pos = 0;
|
||||||
|
let out = '';
|
||||||
|
for (let i = 0; i < decoded.length; i++) {
|
||||||
|
const line = decoded[i];
|
||||||
|
if (i > 0) {
|
||||||
|
if (pos === bufLength) {
|
||||||
|
out += td.decode(buf);
|
||||||
|
pos = 0;
|
||||||
|
}
|
||||||
|
buf[pos++] = semicolon;
|
||||||
|
}
|
||||||
|
if (line.length === 0)
|
||||||
|
continue;
|
||||||
|
state[0] = 0;
|
||||||
|
for (let j = 0; j < line.length; j++) {
|
||||||
|
const segment = line[j];
|
||||||
|
// We can push up to 5 ints, each int can take at most 7 chars, and we
|
||||||
|
// may push a comma.
|
||||||
|
if (pos > subLength) {
|
||||||
|
out += td.decode(sub);
|
||||||
|
buf.copyWithin(0, subLength, pos);
|
||||||
|
pos -= subLength;
|
||||||
|
}
|
||||||
|
if (j > 0)
|
||||||
|
buf[pos++] = comma;
|
||||||
|
pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
|
||||||
|
if (segment.length === 1)
|
||||||
|
continue;
|
||||||
|
pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
|
||||||
|
pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
|
||||||
|
pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
|
||||||
|
if (segment.length === 4)
|
||||||
|
continue;
|
||||||
|
pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out + td.decode(buf.subarray(0, pos));
|
||||||
|
}
|
||||||
|
function encodeInteger(buf, pos, state, segment, j) {
|
||||||
|
const next = segment[j];
|
||||||
|
let num = next - state[j];
|
||||||
|
state[j] = next;
|
||||||
|
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
||||||
|
do {
|
||||||
|
let clamped = num & 0b011111;
|
||||||
|
num >>>= 5;
|
||||||
|
if (num > 0)
|
||||||
|
clamped |= 0b100000;
|
||||||
|
buf[pos++] = intToChar[clamped];
|
||||||
|
} while (num > 0);
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { decode, encode };
|
||||||
|
//# sourceMappingURL=sourcemap-codec.mjs.map
|
1
npm-packages/mac-v3.4.+/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map
vendored
Normal file
1
npm-packages/mac-v3.4.+/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map
vendored
Normal file
File diff suppressed because one or more lines are too long
175
npm-packages/mac-v3.4.+/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js
vendored
Normal file
175
npm-packages/mac-v3.4.+/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js
vendored
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
(function (global, factory) {
|
||||||
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||||
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||||
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.sourcemapCodec = {}));
|
||||||
|
})(this, (function (exports) { 'use strict';
|
||||||
|
|
||||||
|
const comma = ','.charCodeAt(0);
|
||||||
|
const semicolon = ';'.charCodeAt(0);
|
||||||
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||||
|
const intToChar = new Uint8Array(64); // 64 possible chars.
|
||||||
|
const charToInt = new Uint8Array(128); // z is 122 in ASCII
|
||||||
|
for (let i = 0; i < chars.length; i++) {
|
||||||
|
const c = chars.charCodeAt(i);
|
||||||
|
intToChar[i] = c;
|
||||||
|
charToInt[c] = i;
|
||||||
|
}
|
||||||
|
// Provide a fallback for older environments.
|
||||||
|
const td = typeof TextDecoder !== 'undefined'
|
||||||
|
? /* #__PURE__ */ new TextDecoder()
|
||||||
|
: typeof Buffer !== 'undefined'
|
||||||
|
? {
|
||||||
|
decode(buf) {
|
||||||
|
const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
|
||||||
|
return out.toString();
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
decode(buf) {
|
||||||
|
let out = '';
|
||||||
|
for (let i = 0; i < buf.length; i++) {
|
||||||
|
out += String.fromCharCode(buf[i]);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
function decode(mappings) {
|
||||||
|
const state = new Int32Array(5);
|
||||||
|
const decoded = [];
|
||||||
|
let index = 0;
|
||||||
|
do {
|
||||||
|
const semi = indexOf(mappings, index);
|
||||||
|
const line = [];
|
||||||
|
let sorted = true;
|
||||||
|
let lastCol = 0;
|
||||||
|
state[0] = 0;
|
||||||
|
for (let i = index; i < semi; i++) {
|
||||||
|
let seg;
|
||||||
|
i = decodeInteger(mappings, i, state, 0); // genColumn
|
||||||
|
const col = state[0];
|
||||||
|
if (col < lastCol)
|
||||||
|
sorted = false;
|
||||||
|
lastCol = col;
|
||||||
|
if (hasMoreVlq(mappings, i, semi)) {
|
||||||
|
i = decodeInteger(mappings, i, state, 1); // sourcesIndex
|
||||||
|
i = decodeInteger(mappings, i, state, 2); // sourceLine
|
||||||
|
i = decodeInteger(mappings, i, state, 3); // sourceColumn
|
||||||
|
if (hasMoreVlq(mappings, i, semi)) {
|
||||||
|
i = decodeInteger(mappings, i, state, 4); // namesIndex
|
||||||
|
seg = [col, state[1], state[2], state[3], state[4]];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
seg = [col, state[1], state[2], state[3]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
seg = [col];
|
||||||
|
}
|
||||||
|
line.push(seg);
|
||||||
|
}
|
||||||
|
if (!sorted)
|
||||||
|
sort(line);
|
||||||
|
decoded.push(line);
|
||||||
|
index = semi + 1;
|
||||||
|
} while (index <= mappings.length);
|
||||||
|
return decoded;
|
||||||
|
}
|
||||||
|
function indexOf(mappings, index) {
|
||||||
|
const idx = mappings.indexOf(';', index);
|
||||||
|
return idx === -1 ? mappings.length : idx;
|
||||||
|
}
|
||||||
|
function decodeInteger(mappings, pos, state, j) {
|
||||||
|
let value = 0;
|
||||||
|
let shift = 0;
|
||||||
|
let integer = 0;
|
||||||
|
do {
|
||||||
|
const c = mappings.charCodeAt(pos++);
|
||||||
|
integer = charToInt[c];
|
||||||
|
value |= (integer & 31) << shift;
|
||||||
|
shift += 5;
|
||||||
|
} while (integer & 32);
|
||||||
|
const shouldNegate = value & 1;
|
||||||
|
value >>>= 1;
|
||||||
|
if (shouldNegate) {
|
||||||
|
value = -0x80000000 | -value;
|
||||||
|
}
|
||||||
|
state[j] += value;
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
function hasMoreVlq(mappings, i, length) {
|
||||||
|
if (i >= length)
|
||||||
|
return false;
|
||||||
|
return mappings.charCodeAt(i) !== comma;
|
||||||
|
}
|
||||||
|
function sort(line) {
|
||||||
|
line.sort(sortComparator);
|
||||||
|
}
|
||||||
|
function sortComparator(a, b) {
|
||||||
|
return a[0] - b[0];
|
||||||
|
}
|
||||||
|
function encode(decoded) {
|
||||||
|
const state = new Int32Array(5);
|
||||||
|
const bufLength = 1024 * 16;
|
||||||
|
const subLength = bufLength - 36;
|
||||||
|
const buf = new Uint8Array(bufLength);
|
||||||
|
const sub = buf.subarray(0, subLength);
|
||||||
|
let pos = 0;
|
||||||
|
let out = '';
|
||||||
|
for (let i = 0; i < decoded.length; i++) {
|
||||||
|
const line = decoded[i];
|
||||||
|
if (i > 0) {
|
||||||
|
if (pos === bufLength) {
|
||||||
|
out += td.decode(buf);
|
||||||
|
pos = 0;
|
||||||
|
}
|
||||||
|
buf[pos++] = semicolon;
|
||||||
|
}
|
||||||
|
if (line.length === 0)
|
||||||
|
continue;
|
||||||
|
state[0] = 0;
|
||||||
|
for (let j = 0; j < line.length; j++) {
|
||||||
|
const segment = line[j];
|
||||||
|
// We can push up to 5 ints, each int can take at most 7 chars, and we
|
||||||
|
// may push a comma.
|
||||||
|
if (pos > subLength) {
|
||||||
|
out += td.decode(sub);
|
||||||
|
buf.copyWithin(0, subLength, pos);
|
||||||
|
pos -= subLength;
|
||||||
|
}
|
||||||
|
if (j > 0)
|
||||||
|
buf[pos++] = comma;
|
||||||
|
pos = encodeInteger(buf, pos, state, segment, 0); // genColumn
|
||||||
|
if (segment.length === 1)
|
||||||
|
continue;
|
||||||
|
pos = encodeInteger(buf, pos, state, segment, 1); // sourcesIndex
|
||||||
|
pos = encodeInteger(buf, pos, state, segment, 2); // sourceLine
|
||||||
|
pos = encodeInteger(buf, pos, state, segment, 3); // sourceColumn
|
||||||
|
if (segment.length === 4)
|
||||||
|
continue;
|
||||||
|
pos = encodeInteger(buf, pos, state, segment, 4); // namesIndex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out + td.decode(buf.subarray(0, pos));
|
||||||
|
}
|
||||||
|
function encodeInteger(buf, pos, state, segment, j) {
|
||||||
|
const next = segment[j];
|
||||||
|
let num = next - state[j];
|
||||||
|
state[j] = next;
|
||||||
|
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
||||||
|
do {
|
||||||
|
let clamped = num & 0b011111;
|
||||||
|
num >>>= 5;
|
||||||
|
if (num > 0)
|
||||||
|
clamped |= 0b100000;
|
||||||
|
buf[pos++] = intToChar[clamped];
|
||||||
|
} while (num > 0);
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.decode = decode;
|
||||||
|
exports.encode = encode;
|
||||||
|
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
|
}));
|
||||||
|
//# sourceMappingURL=sourcemap-codec.umd.js.map
|
1
npm-packages/mac-v3.4.+/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map
vendored
Normal file
1
npm-packages/mac-v3.4.+/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -3,3 +3,4 @@ export declare type SourceMapLine = SourceMapSegment[];
|
|||||||
export declare type SourceMapMappings = SourceMapLine[];
|
export declare type SourceMapMappings = SourceMapLine[];
|
||||||
export declare function decode(mappings: string): SourceMapMappings;
|
export declare function decode(mappings: string): SourceMapMappings;
|
||||||
export declare function encode(decoded: SourceMapMappings): string;
|
export declare function encode(decoded: SourceMapMappings): string;
|
||||||
|
export declare function encode(decoded: Readonly<SourceMapMappings>): string;
|
@ -0,0 +1,74 @@
|
|||||||
|
{
|
||||||
|
"name": "@jridgewell/sourcemap-codec",
|
||||||
|
"version": "1.4.15",
|
||||||
|
"description": "Encode/decode sourcemap mappings",
|
||||||
|
"keywords": [
|
||||||
|
"sourcemap",
|
||||||
|
"vlq"
|
||||||
|
],
|
||||||
|
"main": "dist/sourcemap-codec.umd.js",
|
||||||
|
"module": "dist/sourcemap-codec.mjs",
|
||||||
|
"types": "dist/types/sourcemap-codec.d.ts",
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"exports": {
|
||||||
|
".": [
|
||||||
|
{
|
||||||
|
"types": "./dist/types/sourcemap-codec.d.ts",
|
||||||
|
"browser": "./dist/sourcemap-codec.umd.js",
|
||||||
|
"require": "./dist/sourcemap-codec.umd.js",
|
||||||
|
"import": "./dist/sourcemap-codec.mjs"
|
||||||
|
},
|
||||||
|
"./dist/sourcemap-codec.umd.js"
|
||||||
|
],
|
||||||
|
"./package.json": "./package.json"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"benchmark": "run-s build:rollup benchmark:*",
|
||||||
|
"benchmark:install": "cd benchmark && npm install",
|
||||||
|
"benchmark:only": "node --expose-gc benchmark/index.js",
|
||||||
|
"build": "run-s -n build:*",
|
||||||
|
"build:rollup": "rollup -c rollup.config.js",
|
||||||
|
"build:ts": "tsc --project tsconfig.build.json",
|
||||||
|
"lint": "run-s -n lint:*",
|
||||||
|
"lint:prettier": "npm run test:lint:prettier -- --write",
|
||||||
|
"lint:ts": "npm run test:lint:ts -- --fix",
|
||||||
|
"prebuild": "rm -rf dist",
|
||||||
|
"prepublishOnly": "npm run preversion",
|
||||||
|
"preversion": "run-s test build",
|
||||||
|
"pretest": "run-s build:rollup",
|
||||||
|
"test": "run-s -n test:lint test:only",
|
||||||
|
"test:debug": "mocha --inspect-brk",
|
||||||
|
"test:lint": "run-s -n test:lint:*",
|
||||||
|
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
|
||||||
|
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
|
||||||
|
"test:only": "mocha",
|
||||||
|
"test:coverage": "c8 mocha",
|
||||||
|
"test:watch": "mocha --watch"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/jridgewell/sourcemap-codec.git"
|
||||||
|
},
|
||||||
|
"author": "Rich Harris",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"@rollup/plugin-typescript": "8.3.0",
|
||||||
|
"@types/node": "17.0.15",
|
||||||
|
"@typescript-eslint/eslint-plugin": "5.10.0",
|
||||||
|
"@typescript-eslint/parser": "5.10.0",
|
||||||
|
"benchmark": "2.1.4",
|
||||||
|
"c8": "7.11.2",
|
||||||
|
"eslint": "8.7.0",
|
||||||
|
"eslint-config-prettier": "8.3.0",
|
||||||
|
"mocha": "9.2.0",
|
||||||
|
"npm-run-all": "4.1.5",
|
||||||
|
"prettier": "2.5.1",
|
||||||
|
"rollup": "2.64.0",
|
||||||
|
"source-map": "0.6.1",
|
||||||
|
"source-map-js": "1.0.2",
|
||||||
|
"sourcemap-codec": "1.4.8",
|
||||||
|
"typescript": "4.5.4"
|
||||||
|
}
|
||||||
|
}
|
74
npm-packages/mac-v3.4.+/@mapbox/node-pre-gyp/.github/workflows/codeql.yml
vendored
Normal file
74
npm-packages/mac-v3.4.+/@mapbox/node-pre-gyp/.github/workflows/codeql.yml
vendored
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# For most projects, this workflow file will not need changing; you simply need
|
||||||
|
# to commit it to your repository.
|
||||||
|
#
|
||||||
|
# You may wish to alter this file to override the set of languages analyzed,
|
||||||
|
# or to provide custom queries or build logic.
|
||||||
|
#
|
||||||
|
# ******** NOTE ********
|
||||||
|
# We have attempted to detect the languages in your repository. Please check
|
||||||
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
|
# supported CodeQL languages.
|
||||||
|
#
|
||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "master" ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ "master" ]
|
||||||
|
schedule:
|
||||||
|
- cron: '24 5 * * 4'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'javascript' ]
|
||||||
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||||
|
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v2
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
# By default, queries listed here will override any specified in a config file.
|
||||||
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
|
|
||||||
|
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
||||||
|
# queries: security-extended,security-and-quality
|
||||||
|
|
||||||
|
|
||||||
|
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
||||||
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||||
|
|
||||||
|
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
||||||
|
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
||||||
|
|
||||||
|
# - run: |
|
||||||
|
# echo "Run, Build Application using script"
|
||||||
|
# ./location_of_script_within_repo/buildscript.sh
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v2
|
||||||
|
with:
|
||||||
|
category: "/language:${{matrix.language}}"
|
@ -1,5 +1,8 @@
|
|||||||
# node-pre-gyp changelog
|
# node-pre-gyp changelog
|
||||||
|
|
||||||
|
## 1.0.11
|
||||||
|
- Fixes dependabot alert [CVE-2021-44906](https://nvd.nist.gov/vuln/detail/CVE-2021-44906)
|
||||||
|
|
||||||
## 1.0.10
|
## 1.0.10
|
||||||
- Upgraded minimist to 1.2.6 to address dependabot alert [CVE-2021-44906](https://nvd.nist.gov/vuln/detail/CVE-2021-44906)
|
- Upgraded minimist to 1.2.6 to address dependabot alert [CVE-2021-44906](https://nvd.nist.gov/vuln/detail/CVE-2021-44906)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@mapbox/node-pre-gyp",
|
"name": "@mapbox/node-pre-gyp",
|
||||||
"description": "Node.js native addon binary install tool",
|
"description": "Node.js native addon binary install tool",
|
||||||
"version": "1.0.10",
|
"version": "1.0.11",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"native",
|
"native",
|
||||||
"addon",
|
"addon",
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vue/compiler-core",
|
"name": "@vue/compiler-core",
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"description": "@vue/compiler-core",
|
"description": "@vue/compiler-core",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"module": "dist/compiler-core.esm-bundler.js",
|
"module": "dist/compiler-core.esm-bundler.js",
|
||||||
@ -32,12 +32,12 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/shared": "3.2.45",
|
"@babel/parser": "^7.21.3",
|
||||||
"@babel/parser": "^7.16.4",
|
"@vue/shared": "3.3.4",
|
||||||
"estree-walker": "^2.0.2",
|
"estree-walker": "^2.0.2",
|
||||||
"source-map": "^0.6.1"
|
"source-map-js": "^1.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/types": "^7.16.0"
|
"@babel/types": "^7.21.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,66 +1,42 @@
|
|||||||
import { CodegenResult } from '@vue/compiler-core';
|
import { ParserOptions, NodeTransform, SourceLocation, CompilerError, DirectiveTransform, CompilerOptions, CodegenResult, RootNode } from '@vue/compiler-core';
|
||||||
import { CompilerError } from '@vue/compiler-core';
|
export * from '@vue/compiler-core';
|
||||||
import { CompilerOptions } from '@vue/compiler-core';
|
|
||||||
import { DirectiveTransform } from '@vue/compiler-core';
|
|
||||||
import { NodeTransform } from '@vue/compiler-core';
|
|
||||||
import { ParserOptions } from '@vue/compiler-core';
|
|
||||||
import { RootNode } from '@vue/compiler-core';
|
|
||||||
import { SourceLocation } from '@vue/compiler-core';
|
|
||||||
|
|
||||||
export declare function compile(template: string, options?: CompilerOptions): CodegenResult;
|
|
||||||
|
|
||||||
export declare function createDOMCompilerError(code: DOMErrorCodes, loc?: SourceLocation): DOMCompilerError;
|
|
||||||
|
|
||||||
declare interface DOMCompilerError extends CompilerError {
|
|
||||||
code: DOMErrorCodes;
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare const DOMDirectiveTransforms: Record<string, DirectiveTransform>;
|
|
||||||
|
|
||||||
export declare const enum DOMErrorCodes {
|
|
||||||
X_V_HTML_NO_EXPRESSION = 51,
|
|
||||||
X_V_HTML_WITH_CHILDREN = 52,
|
|
||||||
X_V_TEXT_NO_EXPRESSION = 53,
|
|
||||||
X_V_TEXT_WITH_CHILDREN = 54,
|
|
||||||
X_V_MODEL_ON_INVALID_ELEMENT = 55,
|
|
||||||
X_V_MODEL_ARG_ON_ELEMENT = 56,
|
|
||||||
X_V_MODEL_ON_FILE_INPUT_ELEMENT = 57,
|
|
||||||
X_V_MODEL_UNNECESSARY_VALUE = 58,
|
|
||||||
X_V_SHOW_NO_EXPRESSION = 59,
|
|
||||||
X_TRANSITION_INVALID_CHILDREN = 60,
|
|
||||||
X_IGNORED_SIDE_EFFECT_TAG = 61,
|
|
||||||
__EXTEND_POINT__ = 62
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare const DOMNodeTransforms: NodeTransform[];
|
|
||||||
|
|
||||||
export declare function parse(template: string, options?: ParserOptions): RootNode;
|
|
||||||
|
|
||||||
export declare const parserOptions: ParserOptions;
|
export declare const parserOptions: ParserOptions;
|
||||||
|
|
||||||
export declare const transformStyle: NodeTransform;
|
export declare const V_MODEL_RADIO: unique symbol;
|
||||||
|
export declare const V_MODEL_CHECKBOX: unique symbol;
|
||||||
|
export declare const V_MODEL_TEXT: unique symbol;
|
||||||
|
export declare const V_MODEL_SELECT: unique symbol;
|
||||||
|
export declare const V_MODEL_DYNAMIC: unique symbol;
|
||||||
|
export declare const V_ON_WITH_MODIFIERS: unique symbol;
|
||||||
|
export declare const V_ON_WITH_KEYS: unique symbol;
|
||||||
|
export declare const V_SHOW: unique symbol;
|
||||||
export declare const TRANSITION: unique symbol;
|
export declare const TRANSITION: unique symbol;
|
||||||
|
|
||||||
export declare const TRANSITION_GROUP: unique symbol;
|
export declare const TRANSITION_GROUP: unique symbol;
|
||||||
|
|
||||||
export declare const V_MODEL_CHECKBOX: unique symbol;
|
export declare const transformStyle: NodeTransform;
|
||||||
|
|
||||||
export declare const V_MODEL_DYNAMIC: unique symbol;
|
interface DOMCompilerError extends CompilerError {
|
||||||
|
code: DOMErrorCodes;
|
||||||
|
}
|
||||||
|
export declare function createDOMCompilerError(code: DOMErrorCodes, loc?: SourceLocation): DOMCompilerError;
|
||||||
|
export declare const enum DOMErrorCodes {
|
||||||
|
X_V_HTML_NO_EXPRESSION = 53,
|
||||||
|
X_V_HTML_WITH_CHILDREN = 54,
|
||||||
|
X_V_TEXT_NO_EXPRESSION = 55,
|
||||||
|
X_V_TEXT_WITH_CHILDREN = 56,
|
||||||
|
X_V_MODEL_ON_INVALID_ELEMENT = 57,
|
||||||
|
X_V_MODEL_ARG_ON_ELEMENT = 58,
|
||||||
|
X_V_MODEL_ON_FILE_INPUT_ELEMENT = 59,
|
||||||
|
X_V_MODEL_UNNECESSARY_VALUE = 60,
|
||||||
|
X_V_SHOW_NO_EXPRESSION = 61,
|
||||||
|
X_TRANSITION_INVALID_CHILDREN = 62,
|
||||||
|
X_IGNORED_SIDE_EFFECT_TAG = 63,
|
||||||
|
__EXTEND_POINT__ = 64
|
||||||
|
}
|
||||||
|
|
||||||
export declare const V_MODEL_RADIO: unique symbol;
|
export declare const DOMNodeTransforms: NodeTransform[];
|
||||||
|
export declare const DOMDirectiveTransforms: Record<string, DirectiveTransform>;
|
||||||
|
export declare function compile(template: string, options?: CompilerOptions): CodegenResult;
|
||||||
|
export declare function parse(template: string, options?: ParserOptions): RootNode;
|
||||||
|
|
||||||
export declare const V_MODEL_SELECT: unique symbol;
|
|
||||||
|
|
||||||
export declare const V_MODEL_TEXT: unique symbol;
|
|
||||||
|
|
||||||
export declare const V_ON_WITH_KEYS: unique symbol;
|
|
||||||
|
|
||||||
export declare const V_ON_WITH_MODIFIERS: unique symbol;
|
|
||||||
|
|
||||||
export declare const V_SHOW: unique symbol;
|
|
||||||
|
|
||||||
|
|
||||||
export * from "@vue/compiler-core";
|
|
||||||
|
|
||||||
export { }
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,17 +1,17 @@
|
|||||||
import { registerRuntimeHelpers, isBuiltInType, createSimpleExpression, createCompilerError, createObjectProperty, getConstantType, createCallExpression, TO_DISPLAY_STRING, transformModel as transformModel$1, findProp, hasDynamicKeyVBind, transformOn as transformOn$1, createCompoundExpression, isStaticExp, checkCompatEnabled, noopDirectiveTransform, baseCompile, baseParse } from '@vue/compiler-core';
|
import { registerRuntimeHelpers, isBuiltInType, createSimpleExpression, createCompilerError, createObjectProperty, getConstantType, createCallExpression, TO_DISPLAY_STRING, transformModel as transformModel$1, findProp, hasDynamicKeyVBind, transformOn as transformOn$1, isStaticExp, createCompoundExpression, checkCompatEnabled, noopDirectiveTransform, baseCompile, baseParse } from '@vue/compiler-core';
|
||||||
export * from '@vue/compiler-core';
|
export * from '@vue/compiler-core';
|
||||||
import { isVoidTag, isHTMLTag, isSVGTag, makeMap, parseStringStyle, capitalize, extend } from '@vue/shared';
|
import { isVoidTag, isHTMLTag, isSVGTag, makeMap, parseStringStyle, capitalize, extend } from '@vue/shared';
|
||||||
|
|
||||||
const V_MODEL_RADIO = Symbol((process.env.NODE_ENV !== 'production') ? `vModelRadio` : ``);
|
const V_MODEL_RADIO = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelRadio` : ``);
|
||||||
const V_MODEL_CHECKBOX = Symbol((process.env.NODE_ENV !== 'production') ? `vModelCheckbox` : ``);
|
const V_MODEL_CHECKBOX = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelCheckbox` : ``);
|
||||||
const V_MODEL_TEXT = Symbol((process.env.NODE_ENV !== 'production') ? `vModelText` : ``);
|
const V_MODEL_TEXT = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelText` : ``);
|
||||||
const V_MODEL_SELECT = Symbol((process.env.NODE_ENV !== 'production') ? `vModelSelect` : ``);
|
const V_MODEL_SELECT = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelSelect` : ``);
|
||||||
const V_MODEL_DYNAMIC = Symbol((process.env.NODE_ENV !== 'production') ? `vModelDynamic` : ``);
|
const V_MODEL_DYNAMIC = Symbol(!!(process.env.NODE_ENV !== "production") ? `vModelDynamic` : ``);
|
||||||
const V_ON_WITH_MODIFIERS = Symbol((process.env.NODE_ENV !== 'production') ? `vOnModifiersGuard` : ``);
|
const V_ON_WITH_MODIFIERS = Symbol(!!(process.env.NODE_ENV !== "production") ? `vOnModifiersGuard` : ``);
|
||||||
const V_ON_WITH_KEYS = Symbol((process.env.NODE_ENV !== 'production') ? `vOnKeysGuard` : ``);
|
const V_ON_WITH_KEYS = Symbol(!!(process.env.NODE_ENV !== "production") ? `vOnKeysGuard` : ``);
|
||||||
const V_SHOW = Symbol((process.env.NODE_ENV !== 'production') ? `vShow` : ``);
|
const V_SHOW = Symbol(!!(process.env.NODE_ENV !== "production") ? `vShow` : ``);
|
||||||
const TRANSITION = Symbol((process.env.NODE_ENV !== 'production') ? `Transition` : ``);
|
const TRANSITION = Symbol(!!(process.env.NODE_ENV !== "production") ? `Transition` : ``);
|
||||||
const TRANSITION_GROUP = Symbol((process.env.NODE_ENV !== 'production') ? `TransitionGroup` : ``);
|
const TRANSITION_GROUP = Symbol(!!(process.env.NODE_ENV !== "production") ? `TransitionGroup` : ``);
|
||||||
registerRuntimeHelpers({
|
registerRuntimeHelpers({
|
||||||
[V_MODEL_RADIO]: `vModelRadio`,
|
[V_MODEL_RADIO]: `vModelRadio`,
|
||||||
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
|
[V_MODEL_CHECKBOX]: `vModelCheckbox`,
|
||||||
@ -25,102 +25,87 @@ registerRuntimeHelpers({
|
|||||||
[TRANSITION_GROUP]: `TransitionGroup`
|
[TRANSITION_GROUP]: `TransitionGroup`
|
||||||
});
|
});
|
||||||
|
|
||||||
/* eslint-disable no-restricted-globals */
|
|
||||||
let decoder;
|
let decoder;
|
||||||
function decodeHtmlBrowser(raw, asAttr = false) {
|
function decodeHtmlBrowser(raw, asAttr = false) {
|
||||||
if (!decoder) {
|
if (!decoder) {
|
||||||
decoder = document.createElement('div');
|
decoder = document.createElement("div");
|
||||||
}
|
}
|
||||||
if (asAttr) {
|
if (asAttr) {
|
||||||
decoder.innerHTML = `<div foo="${raw.replace(/"/g, '"')}">`;
|
decoder.innerHTML = `<div foo="${raw.replace(/"/g, """)}">`;
|
||||||
return decoder.children[0].getAttribute('foo');
|
return decoder.children[0].getAttribute("foo");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
decoder.innerHTML = raw;
|
decoder.innerHTML = raw;
|
||||||
return decoder.textContent;
|
return decoder.textContent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const isRawTextContainer = /*#__PURE__*/ makeMap('style,iframe,script,noscript', true);
|
const isRawTextContainer = /* @__PURE__ */ makeMap(
|
||||||
|
"style,iframe,script,noscript",
|
||||||
|
true
|
||||||
|
);
|
||||||
const parserOptions = {
|
const parserOptions = {
|
||||||
isVoidTag,
|
isVoidTag,
|
||||||
isNativeTag: tag => isHTMLTag(tag) || isSVGTag(tag),
|
isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag),
|
||||||
isPreTag: tag => tag === 'pre',
|
isPreTag: (tag) => tag === "pre",
|
||||||
decodeEntities: decodeHtmlBrowser ,
|
decodeEntities: decodeHtmlBrowser ,
|
||||||
isBuiltInComponent: (tag) => {
|
isBuiltInComponent: (tag) => {
|
||||||
if (isBuiltInType(tag, `Transition`)) {
|
if (isBuiltInType(tag, `Transition`)) {
|
||||||
return TRANSITION;
|
return TRANSITION;
|
||||||
}
|
} else if (isBuiltInType(tag, `TransitionGroup`)) {
|
||||||
else if (isBuiltInType(tag, `TransitionGroup`)) {
|
|
||||||
return TRANSITION_GROUP;
|
return TRANSITION_GROUP;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
||||||
getNamespace(tag, parent) {
|
getNamespace(tag, parent) {
|
||||||
let ns = parent ? parent.ns : 0 /* DOMNamespaces.HTML */;
|
let ns = parent ? parent.ns : 0;
|
||||||
if (parent && ns === 2 /* DOMNamespaces.MATH_ML */) {
|
if (parent && ns === 2) {
|
||||||
if (parent.tag === 'annotation-xml') {
|
if (parent.tag === "annotation-xml") {
|
||||||
if (tag === 'svg') {
|
if (tag === "svg") {
|
||||||
return 1 /* DOMNamespaces.SVG */;
|
return 1;
|
||||||
}
|
}
|
||||||
if (parent.props.some(a => a.type === 6 /* NodeTypes.ATTRIBUTE */ &&
|
if (parent.props.some(
|
||||||
a.name === 'encoding' &&
|
(a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml")
|
||||||
a.value != null &&
|
)) {
|
||||||
(a.value.content === 'text/html' ||
|
ns = 0;
|
||||||
a.value.content === 'application/xhtml+xml'))) {
|
}
|
||||||
ns = 0 /* DOMNamespaces.HTML */;
|
} else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") {
|
||||||
|
ns = 0;
|
||||||
|
}
|
||||||
|
} else if (parent && ns === 1) {
|
||||||
|
if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") {
|
||||||
|
ns = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (/^m(?:[ions]|text)$/.test(parent.tag) &&
|
if (ns === 0) {
|
||||||
tag !== 'mglyph' &&
|
if (tag === "svg") {
|
||||||
tag !== 'malignmark') {
|
return 1;
|
||||||
ns = 0 /* DOMNamespaces.HTML */;
|
|
||||||
}
|
}
|
||||||
}
|
if (tag === "math") {
|
||||||
else if (parent && ns === 1 /* DOMNamespaces.SVG */) {
|
return 2;
|
||||||
if (parent.tag === 'foreignObject' ||
|
|
||||||
parent.tag === 'desc' ||
|
|
||||||
parent.tag === 'title') {
|
|
||||||
ns = 0 /* DOMNamespaces.HTML */;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ns === 0 /* DOMNamespaces.HTML */) {
|
|
||||||
if (tag === 'svg') {
|
|
||||||
return 1 /* DOMNamespaces.SVG */;
|
|
||||||
}
|
|
||||||
if (tag === 'math') {
|
|
||||||
return 2 /* DOMNamespaces.MATH_ML */;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ns;
|
return ns;
|
||||||
},
|
},
|
||||||
// https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
|
// https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
|
||||||
getTextMode({ tag, ns }) {
|
getTextMode({ tag, ns }) {
|
||||||
if (ns === 0 /* DOMNamespaces.HTML */) {
|
if (ns === 0) {
|
||||||
if (tag === 'textarea' || tag === 'title') {
|
if (tag === "textarea" || tag === "title") {
|
||||||
return 1 /* TextModes.RCDATA */;
|
return 1;
|
||||||
}
|
}
|
||||||
if (isRawTextContainer(tag)) {
|
if (isRawTextContainer(tag)) {
|
||||||
return 2 /* TextModes.RAWTEXT */;
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0 /* TextModes.DATA */;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Parse inline CSS strings for static style attributes into an object.
|
const transformStyle = (node) => {
|
||||||
// This is a NodeTransform since it works on the static `style` attribute and
|
if (node.type === 1) {
|
||||||
// converts it into a dynamic equivalent:
|
|
||||||
// style="color: red" -> :style='{ "color": "red" }'
|
|
||||||
// It is then processed by `transformElement` and included in the generated
|
|
||||||
// props.
|
|
||||||
const transformStyle = node => {
|
|
||||||
if (node.type === 1 /* NodeTypes.ELEMENT */) {
|
|
||||||
node.props.forEach((p, i) => {
|
node.props.forEach((p, i) => {
|
||||||
if (p.type === 6 /* NodeTypes.ATTRIBUTE */ && p.name === 'style' && p.value) {
|
if (p.type === 6 && p.name === "style" && p.value) {
|
||||||
// replace p with an expression node
|
|
||||||
node.props[i] = {
|
node.props[i] = {
|
||||||
type: 7 /* NodeTypes.DIRECTIVE */,
|
type: 7,
|
||||||
name: `bind`,
|
name: `bind`,
|
||||||
arg: createSimpleExpression(`style`, true, p.loc),
|
arg: createSimpleExpression(`style`, true, p.loc),
|
||||||
exp: parseInlineCSS(p.value.content, p.loc),
|
exp: parseInlineCSS(p.value.content, p.loc),
|
||||||
@ -133,38 +118,54 @@ const transformStyle = node => {
|
|||||||
};
|
};
|
||||||
const parseInlineCSS = (cssText, loc) => {
|
const parseInlineCSS = (cssText, loc) => {
|
||||||
const normalized = parseStringStyle(cssText);
|
const normalized = parseStringStyle(cssText);
|
||||||
return createSimpleExpression(JSON.stringify(normalized), false, loc, 3 /* ConstantTypes.CAN_STRINGIFY */);
|
return createSimpleExpression(
|
||||||
|
JSON.stringify(normalized),
|
||||||
|
false,
|
||||||
|
loc,
|
||||||
|
3
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function createDOMCompilerError(code, loc) {
|
function createDOMCompilerError(code, loc) {
|
||||||
return createCompilerError(code, loc, (process.env.NODE_ENV !== 'production') || !true ? DOMErrorMessages : undefined);
|
return createCompilerError(
|
||||||
|
code,
|
||||||
|
loc,
|
||||||
|
!!(process.env.NODE_ENV !== "production") || false ? DOMErrorMessages : void 0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const DOMErrorMessages = {
|
const DOMErrorMessages = {
|
||||||
[51 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */]: `v-html is missing expression.`,
|
[53]: `v-html is missing expression.`,
|
||||||
[52 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */]: `v-html will override element children.`,
|
[54]: `v-html will override element children.`,
|
||||||
[53 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */]: `v-text is missing expression.`,
|
[55]: `v-text is missing expression.`,
|
||||||
[54 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */]: `v-text will override element children.`,
|
[56]: `v-text will override element children.`,
|
||||||
[55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
[57]: `v-model can only be used on <input>, <textarea> and <select> elements.`,
|
||||||
[56 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */]: `v-model argument is not supported on plain elements.`,
|
[58]: `v-model argument is not supported on plain elements.`,
|
||||||
[57 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
[59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`,
|
||||||
[58 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
[60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`,
|
||||||
[59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */]: `v-show is missing expression.`,
|
[61]: `v-show is missing expression.`,
|
||||||
[60 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */]: `<Transition> expects exactly one child element or component.`,
|
[62]: `<Transition> expects exactly one child element or component.`,
|
||||||
[61 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
[63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.`
|
||||||
};
|
};
|
||||||
|
|
||||||
const transformVHtml = (dir, node, context) => {
|
const transformVHtml = (dir, node, context) => {
|
||||||
const { exp, loc } = dir;
|
const { exp, loc } = dir;
|
||||||
if (!exp) {
|
if (!exp) {
|
||||||
context.onError(createDOMCompilerError(51 /* DOMErrorCodes.X_V_HTML_NO_EXPRESSION */, loc));
|
context.onError(
|
||||||
|
createDOMCompilerError(53, loc)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (node.children.length) {
|
if (node.children.length) {
|
||||||
context.onError(createDOMCompilerError(52 /* DOMErrorCodes.X_V_HTML_WITH_CHILDREN */, loc));
|
context.onError(
|
||||||
|
createDOMCompilerError(54, loc)
|
||||||
|
);
|
||||||
node.children.length = 0;
|
node.children.length = 0;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
props: [
|
props: [
|
||||||
createObjectProperty(createSimpleExpression(`innerHTML`, true, loc), exp || createSimpleExpression('', true))
|
createObjectProperty(
|
||||||
|
createSimpleExpression(`innerHTML`, true, loc),
|
||||||
|
exp || createSimpleExpression("", true)
|
||||||
|
)
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -172,153 +173,153 @@ const transformVHtml = (dir, node, context) => {
|
|||||||
const transformVText = (dir, node, context) => {
|
const transformVText = (dir, node, context) => {
|
||||||
const { exp, loc } = dir;
|
const { exp, loc } = dir;
|
||||||
if (!exp) {
|
if (!exp) {
|
||||||
context.onError(createDOMCompilerError(53 /* DOMErrorCodes.X_V_TEXT_NO_EXPRESSION */, loc));
|
context.onError(
|
||||||
|
createDOMCompilerError(55, loc)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (node.children.length) {
|
if (node.children.length) {
|
||||||
context.onError(createDOMCompilerError(54 /* DOMErrorCodes.X_V_TEXT_WITH_CHILDREN */, loc));
|
context.onError(
|
||||||
|
createDOMCompilerError(56, loc)
|
||||||
|
);
|
||||||
node.children.length = 0;
|
node.children.length = 0;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
props: [
|
props: [
|
||||||
createObjectProperty(createSimpleExpression(`textContent`, true), exp
|
createObjectProperty(
|
||||||
? getConstantType(exp, context) > 0
|
createSimpleExpression(`textContent`, true),
|
||||||
? exp
|
exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression(
|
||||||
: createCallExpression(context.helperString(TO_DISPLAY_STRING), [exp], loc)
|
context.helperString(TO_DISPLAY_STRING),
|
||||||
: createSimpleExpression('', true))
|
[exp],
|
||||||
|
loc
|
||||||
|
) : createSimpleExpression("", true)
|
||||||
|
)
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const transformModel = (dir, node, context) => {
|
const transformModel = (dir, node, context) => {
|
||||||
const baseResult = transformModel$1(dir, node, context);
|
const baseResult = transformModel$1(dir, node, context);
|
||||||
// base transform has errors OR component v-model (only need props)
|
if (!baseResult.props.length || node.tagType === 1) {
|
||||||
if (!baseResult.props.length || node.tagType === 1 /* ElementTypes.COMPONENT */) {
|
|
||||||
return baseResult;
|
return baseResult;
|
||||||
}
|
}
|
||||||
if (dir.arg) {
|
if (dir.arg) {
|
||||||
context.onError(createDOMCompilerError(56 /* DOMErrorCodes.X_V_MODEL_ARG_ON_ELEMENT */, dir.arg.loc));
|
context.onError(
|
||||||
|
createDOMCompilerError(
|
||||||
|
58,
|
||||||
|
dir.arg.loc
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
function checkDuplicatedValue() {
|
function checkDuplicatedValue() {
|
||||||
const value = findProp(node, 'value');
|
const value = findProp(node, "value");
|
||||||
if (value) {
|
if (value) {
|
||||||
context.onError(createDOMCompilerError(58 /* DOMErrorCodes.X_V_MODEL_UNNECESSARY_VALUE */, value.loc));
|
context.onError(
|
||||||
|
createDOMCompilerError(
|
||||||
|
60,
|
||||||
|
value.loc
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const { tag } = node;
|
const { tag } = node;
|
||||||
const isCustomElement = context.isCustomElement(tag);
|
const isCustomElement = context.isCustomElement(tag);
|
||||||
if (tag === 'input' ||
|
if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) {
|
||||||
tag === 'textarea' ||
|
|
||||||
tag === 'select' ||
|
|
||||||
isCustomElement) {
|
|
||||||
let directiveToUse = V_MODEL_TEXT;
|
let directiveToUse = V_MODEL_TEXT;
|
||||||
let isInvalidType = false;
|
let isInvalidType = false;
|
||||||
if (tag === 'input' || isCustomElement) {
|
if (tag === "input" || isCustomElement) {
|
||||||
const type = findProp(node, `type`);
|
const type = findProp(node, `type`);
|
||||||
if (type) {
|
if (type) {
|
||||||
if (type.type === 7 /* NodeTypes.DIRECTIVE */) {
|
if (type.type === 7) {
|
||||||
// :type="foo"
|
|
||||||
directiveToUse = V_MODEL_DYNAMIC;
|
directiveToUse = V_MODEL_DYNAMIC;
|
||||||
}
|
} else if (type.value) {
|
||||||
else if (type.value) {
|
|
||||||
switch (type.value.content) {
|
switch (type.value.content) {
|
||||||
case 'radio':
|
case "radio":
|
||||||
directiveToUse = V_MODEL_RADIO;
|
directiveToUse = V_MODEL_RADIO;
|
||||||
break;
|
break;
|
||||||
case 'checkbox':
|
case "checkbox":
|
||||||
directiveToUse = V_MODEL_CHECKBOX;
|
directiveToUse = V_MODEL_CHECKBOX;
|
||||||
break;
|
break;
|
||||||
case 'file':
|
case "file":
|
||||||
isInvalidType = true;
|
isInvalidType = true;
|
||||||
context.onError(createDOMCompilerError(57 /* DOMErrorCodes.X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc));
|
context.onError(
|
||||||
|
createDOMCompilerError(
|
||||||
|
59,
|
||||||
|
dir.loc
|
||||||
|
)
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// text type
|
!!(process.env.NODE_ENV !== "production") && checkDuplicatedValue();
|
||||||
(process.env.NODE_ENV !== 'production') && checkDuplicatedValue();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (hasDynamicKeyVBind(node)) {
|
||||||
else if (hasDynamicKeyVBind(node)) {
|
|
||||||
// element has bindings with dynamic keys, which can possibly contain
|
|
||||||
// "type".
|
|
||||||
directiveToUse = V_MODEL_DYNAMIC;
|
directiveToUse = V_MODEL_DYNAMIC;
|
||||||
|
} else {
|
||||||
|
!!(process.env.NODE_ENV !== "production") && checkDuplicatedValue();
|
||||||
}
|
}
|
||||||
else {
|
} else if (tag === "select") {
|
||||||
// text type
|
|
||||||
(process.env.NODE_ENV !== 'production') && checkDuplicatedValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (tag === 'select') {
|
|
||||||
directiveToUse = V_MODEL_SELECT;
|
directiveToUse = V_MODEL_SELECT;
|
||||||
|
} else {
|
||||||
|
!!(process.env.NODE_ENV !== "production") && checkDuplicatedValue();
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
// textarea
|
|
||||||
(process.env.NODE_ENV !== 'production') && checkDuplicatedValue();
|
|
||||||
}
|
|
||||||
// inject runtime directive
|
|
||||||
// by returning the helper symbol via needRuntime
|
|
||||||
// the import will replaced a resolveDirective call.
|
|
||||||
if (!isInvalidType) {
|
if (!isInvalidType) {
|
||||||
baseResult.needRuntime = context.helper(directiveToUse);
|
baseResult.needRuntime = context.helper(directiveToUse);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
context.onError(
|
||||||
|
createDOMCompilerError(
|
||||||
|
57,
|
||||||
|
dir.loc
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else {
|
baseResult.props = baseResult.props.filter(
|
||||||
context.onError(createDOMCompilerError(55 /* DOMErrorCodes.X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc));
|
(p) => !(p.key.type === 4 && p.key.content === "modelValue")
|
||||||
}
|
);
|
||||||
// native vmodel doesn't need the `modelValue` props since they are also
|
|
||||||
// passed to the runtime as `binding.value`. removing it reduces code size.
|
|
||||||
baseResult.props = baseResult.props.filter(p => !(p.key.type === 4 /* NodeTypes.SIMPLE_EXPRESSION */ &&
|
|
||||||
p.key.content === 'modelValue'));
|
|
||||||
return baseResult;
|
return baseResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
const isEventOptionModifier = /*#__PURE__*/ makeMap(`passive,once,capture`);
|
const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`);
|
||||||
const isNonKeyModifier = /*#__PURE__*/ makeMap(
|
const isNonKeyModifier = /* @__PURE__ */ makeMap(
|
||||||
// event propagation management
|
// event propagation management
|
||||||
`stop,prevent,self,` +
|
`stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
|
||||||
// system modifiers + exact
|
);
|
||||||
`ctrl,shift,alt,meta,exact,` +
|
const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
|
||||||
// mouse
|
const isKeyboardEvent = /* @__PURE__ */ makeMap(
|
||||||
`middle`);
|
`onkeyup,onkeydown,onkeypress`,
|
||||||
// left & right could be mouse or key modifiers based on event type
|
true
|
||||||
const maybeKeyModifier = /*#__PURE__*/ makeMap('left,right');
|
);
|
||||||
const isKeyboardEvent = /*#__PURE__*/ makeMap(`onkeyup,onkeydown,onkeypress`, true);
|
|
||||||
const resolveModifiers = (key, modifiers, context, loc) => {
|
const resolveModifiers = (key, modifiers, context, loc) => {
|
||||||
const keyModifiers = [];
|
const keyModifiers = [];
|
||||||
const nonKeyModifiers = [];
|
const nonKeyModifiers = [];
|
||||||
const eventOptionModifiers = [];
|
const eventOptionModifiers = [];
|
||||||
for (let i = 0; i < modifiers.length; i++) {
|
for (let i = 0; i < modifiers.length; i++) {
|
||||||
const modifier = modifiers[i];
|
const modifier = modifiers[i];
|
||||||
if (modifier === 'native' &&
|
if (modifier === "native" && checkCompatEnabled(
|
||||||
checkCompatEnabled("COMPILER_V_ON_NATIVE" /* CompilerDeprecationTypes.COMPILER_V_ON_NATIVE */, context, loc)) {
|
"COMPILER_V_ON_NATIVE",
|
||||||
|
context,
|
||||||
|
loc
|
||||||
|
)) {
|
||||||
eventOptionModifiers.push(modifier);
|
eventOptionModifiers.push(modifier);
|
||||||
}
|
} else if (isEventOptionModifier(modifier)) {
|
||||||
else if (isEventOptionModifier(modifier)) {
|
|
||||||
// eventOptionModifiers: modifiers for addEventListener() options,
|
|
||||||
// e.g. .passive & .capture
|
|
||||||
eventOptionModifiers.push(modifier);
|
eventOptionModifiers.push(modifier);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// runtimeModifiers: modifiers that needs runtime guards
|
|
||||||
if (maybeKeyModifier(modifier)) {
|
if (maybeKeyModifier(modifier)) {
|
||||||
if (isStaticExp(key)) {
|
if (isStaticExp(key)) {
|
||||||
if (isKeyboardEvent(key.content)) {
|
if (isKeyboardEvent(key.content)) {
|
||||||
keyModifiers.push(modifier);
|
keyModifiers.push(modifier);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
nonKeyModifiers.push(modifier);
|
nonKeyModifiers.push(modifier);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
keyModifiers.push(modifier);
|
keyModifiers.push(modifier);
|
||||||
nonKeyModifiers.push(modifier);
|
nonKeyModifiers.push(modifier);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (isNonKeyModifier(modifier)) {
|
if (isNonKeyModifier(modifier)) {
|
||||||
nonKeyModifiers.push(modifier);
|
nonKeyModifiers.push(modifier);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
keyModifiers.push(modifier);
|
keyModifiers.push(modifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -331,31 +332,26 @@ const resolveModifiers = (key, modifiers, context, loc) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
const transformClick = (key, event) => {
|
const transformClick = (key, event) => {
|
||||||
const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === 'onclick';
|
const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick";
|
||||||
return isStaticClick
|
return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([
|
||||||
? createSimpleExpression(event, true)
|
|
||||||
: key.type !== 4 /* NodeTypes.SIMPLE_EXPRESSION */
|
|
||||||
? createCompoundExpression([
|
|
||||||
`(`,
|
`(`,
|
||||||
key,
|
key,
|
||||||
`) === "onClick" ? "${event}" : (`,
|
`) === "onClick" ? "${event}" : (`,
|
||||||
key,
|
key,
|
||||||
`)`
|
`)`
|
||||||
])
|
]) : key;
|
||||||
: key;
|
|
||||||
};
|
};
|
||||||
const transformOn = (dir, node, context) => {
|
const transformOn = (dir, node, context) => {
|
||||||
return transformOn$1(dir, node, context, baseResult => {
|
return transformOn$1(dir, node, context, (baseResult) => {
|
||||||
const { modifiers } = dir;
|
const { modifiers } = dir;
|
||||||
if (!modifiers.length)
|
if (!modifiers.length)
|
||||||
return baseResult;
|
return baseResult;
|
||||||
let { key, value: handlerExp } = baseResult.props[0];
|
let { key, value: handlerExp } = baseResult.props[0];
|
||||||
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
|
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc);
|
||||||
// normalize click.right and click.middle since they don't actually fire
|
if (nonKeyModifiers.includes("right")) {
|
||||||
if (nonKeyModifiers.includes('right')) {
|
|
||||||
key = transformClick(key, `onContextmenu`);
|
key = transformClick(key, `onContextmenu`);
|
||||||
}
|
}
|
||||||
if (nonKeyModifiers.includes('middle')) {
|
if (nonKeyModifiers.includes("middle")) {
|
||||||
key = transformClick(key, `onMouseup`);
|
key = transformClick(key, `onMouseup`);
|
||||||
}
|
}
|
||||||
if (nonKeyModifiers.length) {
|
if (nonKeyModifiers.length) {
|
||||||
@ -364,8 +360,7 @@ const transformOn = (dir, node, context) => {
|
|||||||
JSON.stringify(nonKeyModifiers)
|
JSON.stringify(nonKeyModifiers)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
if (keyModifiers.length &&
|
if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard
|
||||||
// if event name is dynamic, always wrap with keys guard
|
|
||||||
(!isStaticExp(key) || isKeyboardEvent(key.content))) {
|
(!isStaticExp(key) || isKeyboardEvent(key.content))) {
|
||||||
handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
|
handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [
|
||||||
handlerExp,
|
handlerExp,
|
||||||
@ -373,10 +368,8 @@ const transformOn = (dir, node, context) => {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
if (eventOptionModifiers.length) {
|
if (eventOptionModifiers.length) {
|
||||||
const modifierPostfix = eventOptionModifiers.map(capitalize).join('');
|
const modifierPostfix = eventOptionModifiers.map(capitalize).join("");
|
||||||
key = isStaticExp(key)
|
key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
|
||||||
? createSimpleExpression(`${key.content}${modifierPostfix}`, true)
|
|
||||||
: createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]);
|
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
props: [createObjectProperty(key, handlerExp)]
|
props: [createObjectProperty(key, handlerExp)]
|
||||||
@ -387,7 +380,9 @@ const transformOn = (dir, node, context) => {
|
|||||||
const transformShow = (dir, node, context) => {
|
const transformShow = (dir, node, context) => {
|
||||||
const { exp, loc } = dir;
|
const { exp, loc } = dir;
|
||||||
if (!exp) {
|
if (!exp) {
|
||||||
context.onError(createDOMCompilerError(59 /* DOMErrorCodes.X_V_SHOW_NO_EXPRESSION */, loc));
|
context.onError(
|
||||||
|
createDOMCompilerError(61, loc)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
props: [],
|
props: [],
|
||||||
@ -396,32 +391,33 @@ const transformShow = (dir, node, context) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const transformTransition = (node, context) => {
|
const transformTransition = (node, context) => {
|
||||||
if (node.type === 1 /* NodeTypes.ELEMENT */ &&
|
if (node.type === 1 && node.tagType === 1) {
|
||||||
node.tagType === 1 /* ElementTypes.COMPONENT */) {
|
|
||||||
const component = context.isBuiltInComponent(node.tag);
|
const component = context.isBuiltInComponent(node.tag);
|
||||||
if (component === TRANSITION) {
|
if (component === TRANSITION) {
|
||||||
return () => {
|
return () => {
|
||||||
if (!node.children.length) {
|
if (!node.children.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// warn multiple transition children
|
|
||||||
if (hasMultipleChildren(node)) {
|
if (hasMultipleChildren(node)) {
|
||||||
context.onError(createDOMCompilerError(60 /* DOMErrorCodes.X_TRANSITION_INVALID_CHILDREN */, {
|
context.onError(
|
||||||
|
createDOMCompilerError(
|
||||||
|
62,
|
||||||
|
{
|
||||||
start: node.children[0].loc.start,
|
start: node.children[0].loc.start,
|
||||||
end: node.children[node.children.length - 1].loc.end,
|
end: node.children[node.children.length - 1].loc.end,
|
||||||
source: ''
|
source: ""
|
||||||
}));
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// check if it's s single child w/ v-show
|
|
||||||
// if yes, inject "persisted: true" to the transition props
|
|
||||||
const child = node.children[0];
|
const child = node.children[0];
|
||||||
if (child.type === 1 /* NodeTypes.ELEMENT */) {
|
if (child.type === 1) {
|
||||||
for (const p of child.props) {
|
for (const p of child.props) {
|
||||||
if (p.type === 7 /* NodeTypes.DIRECTIVE */ && p.name === 'show') {
|
if (p.type === 7 && p.name === "show") {
|
||||||
node.props.push({
|
node.props.push({
|
||||||
type: 6 /* NodeTypes.ATTRIBUTE */,
|
type: 6,
|
||||||
name: 'persisted',
|
name: "persisted",
|
||||||
value: undefined,
|
value: void 0,
|
||||||
loc: node.loc
|
loc: node.loc
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -432,49 +428,59 @@ const transformTransition = (node, context) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
function hasMultipleChildren(node) {
|
function hasMultipleChildren(node) {
|
||||||
// #1352 filter out potential comment nodes.
|
const children = node.children = node.children.filter(
|
||||||
const children = (node.children = node.children.filter(c => c.type !== 3 /* NodeTypes.COMMENT */ &&
|
(c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
|
||||||
!(c.type === 2 /* NodeTypes.TEXT */ && !c.content.trim())));
|
);
|
||||||
const child = children[0];
|
const child = children[0];
|
||||||
return (children.length !== 1 ||
|
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
|
||||||
child.type === 11 /* NodeTypes.FOR */ ||
|
|
||||||
(child.type === 9 /* NodeTypes.IF */ && child.branches.some(hasMultipleChildren)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ignoreSideEffectTags = (node, context) => {
|
const ignoreSideEffectTags = (node, context) => {
|
||||||
if (node.type === 1 /* NodeTypes.ELEMENT */ &&
|
if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) {
|
||||||
node.tagType === 0 /* ElementTypes.ELEMENT */ &&
|
!!(process.env.NODE_ENV !== "production") && context.onError(
|
||||||
(node.tag === 'script' || node.tag === 'style')) {
|
createDOMCompilerError(
|
||||||
context.onError(createDOMCompilerError(61 /* DOMErrorCodes.X_IGNORED_SIDE_EFFECT_TAG */, node.loc));
|
63,
|
||||||
|
node.loc
|
||||||
|
)
|
||||||
|
);
|
||||||
context.removeNode();
|
context.removeNode();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const DOMNodeTransforms = [
|
const DOMNodeTransforms = [
|
||||||
transformStyle,
|
transformStyle,
|
||||||
...((process.env.NODE_ENV !== 'production') ? [transformTransition] : [])
|
...!!(process.env.NODE_ENV !== "production") ? [transformTransition] : []
|
||||||
];
|
];
|
||||||
const DOMDirectiveTransforms = {
|
const DOMDirectiveTransforms = {
|
||||||
cloak: noopDirectiveTransform,
|
cloak: noopDirectiveTransform,
|
||||||
html: transformVHtml,
|
html: transformVHtml,
|
||||||
text: transformVText,
|
text: transformVText,
|
||||||
model: transformModel,
|
model: transformModel,
|
||||||
|
// override compiler-core
|
||||||
on: transformOn,
|
on: transformOn,
|
||||||
|
// override compiler-core
|
||||||
show: transformShow
|
show: transformShow
|
||||||
};
|
};
|
||||||
function compile(template, options = {}) {
|
function compile(template, options = {}) {
|
||||||
return baseCompile(template, extend({}, parserOptions, options, {
|
return baseCompile(
|
||||||
|
template,
|
||||||
|
extend({}, parserOptions, options, {
|
||||||
nodeTransforms: [
|
nodeTransforms: [
|
||||||
// ignore <script> and <tag>
|
// ignore <script> and <tag>
|
||||||
// this is not put inside DOMNodeTransforms because that list is used
|
// this is not put inside DOMNodeTransforms because that list is used
|
||||||
// by compiler-ssr to generate vnode fallback branches
|
// by compiler-ssr to generate vnode fallback branches
|
||||||
ignoreSideEffectTags,
|
ignoreSideEffectTags,
|
||||||
...DOMNodeTransforms,
|
...DOMNodeTransforms,
|
||||||
...(options.nodeTransforms || [])
|
...options.nodeTransforms || []
|
||||||
],
|
],
|
||||||
directiveTransforms: extend({}, DOMDirectiveTransforms, options.directiveTransforms || {}),
|
directiveTransforms: extend(
|
||||||
|
{},
|
||||||
|
DOMDirectiveTransforms,
|
||||||
|
options.directiveTransforms || {}
|
||||||
|
),
|
||||||
transformHoist: null
|
transformHoist: null
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
function parse(template, options = {}) {
|
function parse(template, options = {}) {
|
||||||
return baseParse(template, extend({}, parserOptions, options));
|
return baseParse(template, extend({}, parserOptions, options));
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vue/compiler-dom",
|
"name": "@vue/compiler-dom",
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"description": "@vue/compiler-dom",
|
"description": "@vue/compiler-dom",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"module": "dist/compiler-dom.esm-bundler.js",
|
"module": "dist/compiler-dom.esm-bundler.js",
|
||||||
@ -37,7 +37,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme",
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-dom#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/shared": "3.2.45",
|
"@vue/shared": "3.3.4",
|
||||||
"@vue/compiler-core": "3.2.45"
|
"@vue/compiler-core": "3.3.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because one or more lines are too long
@ -1,28 +1,19 @@
|
|||||||
import { parse as babelParse } from '@babel/parser';
|
import * as _babel_types from '@babel/types';
|
||||||
import { BindingMetadata } from '@vue/compiler-core';
|
import { Statement, Expression, TSType, Program, Node, ObjectPattern, TSModuleDeclaration, TSPropertySignature, TSMethodSignature, TSCallSignatureDeclaration, TSFunctionType } from '@babel/types';
|
||||||
import { CodegenResult } from '@vue/compiler-core';
|
import { CompilerOptions, CodegenResult, ParserOptions, RootNode, CompilerError, SourceLocation, ElementNode, BindingMetadata as BindingMetadata$1 } from '@vue/compiler-core';
|
||||||
import { CompilerError } from '@vue/compiler-core';
|
export { BindingMetadata, CompilerError, CompilerOptions, extractIdentifiers, generateCodeFrame, isInDestructureAssignment, isStaticProperty, walkIdentifiers } from '@vue/compiler-core';
|
||||||
import { CompilerOptions } from '@vue/compiler-core';
|
import { RawSourceMap } from 'source-map-js';
|
||||||
import { ElementNode } from '@vue/compiler-core';
|
|
||||||
import { extractIdentifiers } from '@vue/compiler-core';
|
|
||||||
import { generateCodeFrame } from '@vue/compiler-core';
|
|
||||||
import { isInDestructureAssignment } from '@vue/compiler-core';
|
|
||||||
import { isStaticProperty } from '@vue/compiler-core';
|
|
||||||
import { LazyResult } from 'postcss';
|
|
||||||
import MagicString from 'magic-string';
|
|
||||||
import { ParserOptions } from '@vue/compiler-core';
|
|
||||||
import { ParserPlugin } from '@babel/parser';
|
import { ParserPlugin } from '@babel/parser';
|
||||||
import { RawSourceMap } from 'source-map';
|
export { parse as babelParse } from '@babel/parser';
|
||||||
import { Result } from 'postcss';
|
import { Result, LazyResult } from 'postcss';
|
||||||
import { RootNode } from '@vue/compiler-core';
|
import MagicString from 'magic-string';
|
||||||
import { shouldTransform as shouldTransformRef } from '@vue/reactivity-transform';
|
export { default as MagicString } from 'magic-string';
|
||||||
import { SourceLocation } from '@vue/compiler-core';
|
export { shouldTransform as shouldTransformRef, transform as transformRef, transformAST as transformRefAST } from '@vue/reactivity-transform';
|
||||||
import { Statement } from '@babel/types';
|
|
||||||
import { transform as transformRef } from '@vue/reactivity-transform';
|
|
||||||
import { transformAST as transformRefAST } from '@vue/reactivity-transform';
|
|
||||||
import { walkIdentifiers } from '@vue/compiler-core';
|
|
||||||
|
|
||||||
export declare interface AssetURLOptions {
|
export interface AssetURLTagConfig {
|
||||||
|
[name: string]: string[];
|
||||||
|
}
|
||||||
|
export interface AssetURLOptions {
|
||||||
/**
|
/**
|
||||||
* If base is provided, instead of transforming relative asset urls into
|
* If base is provided, instead of transforming relative asset urls into
|
||||||
* imports, they will be directly rewritten to absolute urls.
|
* imports, they will be directly rewritten to absolute urls.
|
||||||
@ -35,234 +26,20 @@ export declare interface AssetURLOptions {
|
|||||||
tags?: AssetURLTagConfig;
|
tags?: AssetURLTagConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
export declare interface AssetURLTagConfig {
|
export interface TemplateCompiler {
|
||||||
[name: string]: string[];
|
compile(template: string, options: CompilerOptions): CodegenResult;
|
||||||
|
parse(template: string, options: ParserOptions): RootNode;
|
||||||
}
|
}
|
||||||
|
export interface SFCTemplateCompileResults {
|
||||||
export { babelParse }
|
|
||||||
|
|
||||||
export { BindingMetadata }
|
|
||||||
|
|
||||||
export { CompilerError }
|
|
||||||
|
|
||||||
export { CompilerOptions }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compile `<script setup>`
|
|
||||||
* It requires the whole SFC descriptor because we need to handle and merge
|
|
||||||
* normal `<script>` + `<script setup>` if both are present.
|
|
||||||
*/
|
|
||||||
export declare function compileScript(sfc: SFCDescriptor, options: SFCScriptCompileOptions): SFCScriptBlock;
|
|
||||||
|
|
||||||
export declare function compileStyle(options: SFCStyleCompileOptions): SFCStyleCompileResults;
|
|
||||||
|
|
||||||
export declare function compileStyleAsync(options: SFCAsyncStyleCompileOptions): Promise<SFCStyleCompileResults>;
|
|
||||||
|
|
||||||
export declare function compileTemplate(options: SFCTemplateCompileOptions): SFCTemplateCompileResults;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Aligns with postcss-modules
|
|
||||||
* https://github.com/css-modules/postcss-modules
|
|
||||||
*/
|
|
||||||
declare interface CSSModulesOptions {
|
|
||||||
scopeBehaviour?: 'global' | 'local';
|
|
||||||
generateScopedName?: string | ((name: string, filename: string, css: string) => string);
|
|
||||||
hashPrefix?: string;
|
|
||||||
localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly';
|
|
||||||
exportGlobals?: boolean;
|
|
||||||
globalModulePaths?: RegExp[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export { extractIdentifiers }
|
|
||||||
|
|
||||||
export { generateCodeFrame }
|
|
||||||
|
|
||||||
declare interface ImportBinding {
|
|
||||||
isType: boolean;
|
|
||||||
imported: string;
|
|
||||||
local: string;
|
|
||||||
source: string;
|
|
||||||
isFromSetup: boolean;
|
|
||||||
isUsedInTemplate: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export { isInDestructureAssignment }
|
|
||||||
|
|
||||||
export { isStaticProperty }
|
|
||||||
|
|
||||||
export { MagicString }
|
|
||||||
|
|
||||||
export declare function parse(source: string, { sourceMap, filename, sourceRoot, pad, ignoreEmpty, compiler }?: SFCParseOptions): SFCParseResult;
|
|
||||||
|
|
||||||
declare type PreprocessLang = 'less' | 'sass' | 'scss' | 'styl' | 'stylus';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Utility for rewriting `export default` in a script block into a variable
|
|
||||||
* declaration so that we can inject things into it
|
|
||||||
*/
|
|
||||||
export declare function rewriteDefault(input: string, as: string, parserPlugins?: ParserPlugin[]): string;
|
|
||||||
|
|
||||||
export declare interface SFCAsyncStyleCompileOptions extends SFCStyleCompileOptions {
|
|
||||||
isAsync?: boolean;
|
|
||||||
modules?: boolean;
|
|
||||||
modulesOptions?: CSSModulesOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare interface SFCBlock {
|
|
||||||
type: string;
|
|
||||||
content: string;
|
|
||||||
attrs: Record<string, string | true>;
|
|
||||||
loc: SourceLocation;
|
|
||||||
map?: RawSourceMap;
|
|
||||||
lang?: string;
|
|
||||||
src?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare interface SFCDescriptor {
|
|
||||||
filename: string;
|
|
||||||
source: string;
|
|
||||||
template: SFCTemplateBlock | null;
|
|
||||||
script: SFCScriptBlock | null;
|
|
||||||
scriptSetup: SFCScriptBlock | null;
|
|
||||||
styles: SFCStyleBlock[];
|
|
||||||
customBlocks: SFCBlock[];
|
|
||||||
cssVars: string[];
|
|
||||||
/**
|
|
||||||
* whether the SFC uses :slotted() modifier.
|
|
||||||
* this is used as a compiler optimization hint.
|
|
||||||
*/
|
|
||||||
slotted: boolean;
|
|
||||||
/**
|
|
||||||
* compare with an existing descriptor to determine whether HMR should perform
|
|
||||||
* a reload vs. re-render.
|
|
||||||
*
|
|
||||||
* Note: this comparison assumes the prev/next script are already identical,
|
|
||||||
* and only checks the special case where <script setup lang="ts"> unused import
|
|
||||||
* pruning result changes due to template changes.
|
|
||||||
*/
|
|
||||||
shouldForceReload: (prevImports: Record<string, ImportBinding>) => boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare interface SFCParseOptions {
|
|
||||||
filename?: string;
|
|
||||||
sourceMap?: boolean;
|
|
||||||
sourceRoot?: string;
|
|
||||||
pad?: boolean | 'line' | 'space';
|
|
||||||
ignoreEmpty?: boolean;
|
|
||||||
compiler?: TemplateCompiler;
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare interface SFCParseResult {
|
|
||||||
descriptor: SFCDescriptor;
|
|
||||||
errors: (CompilerError | SyntaxError)[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare interface SFCScriptBlock extends SFCBlock {
|
|
||||||
type: 'script';
|
|
||||||
setup?: string | boolean;
|
|
||||||
bindings?: BindingMetadata;
|
|
||||||
imports?: Record<string, ImportBinding>;
|
|
||||||
scriptAst?: Statement[];
|
|
||||||
scriptSetupAst?: Statement[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare interface SFCScriptCompileOptions {
|
|
||||||
/**
|
|
||||||
* Scope ID for prefixing injected CSS variables.
|
|
||||||
* This must be consistent with the `id` passed to `compileStyle`.
|
|
||||||
*/
|
|
||||||
id: string;
|
|
||||||
/**
|
|
||||||
* Production mode. Used to determine whether to generate hashed CSS variables
|
|
||||||
*/
|
|
||||||
isProd?: boolean;
|
|
||||||
/**
|
|
||||||
* Enable/disable source map. Defaults to true.
|
|
||||||
*/
|
|
||||||
sourceMap?: boolean;
|
|
||||||
/**
|
|
||||||
* https://babeljs.io/docs/en/babel-parser#plugins
|
|
||||||
*/
|
|
||||||
babelParserPlugins?: ParserPlugin[];
|
|
||||||
/**
|
|
||||||
* (Experimental) Enable syntax transform for using refs without `.value` and
|
|
||||||
* using destructured props with reactivity
|
|
||||||
*/
|
|
||||||
reactivityTransform?: boolean;
|
|
||||||
/**
|
|
||||||
* (Experimental) Enable syntax transform for using refs without `.value`
|
|
||||||
* https://github.com/vuejs/rfcs/discussions/369
|
|
||||||
* @deprecated now part of `reactivityTransform`
|
|
||||||
* @default false
|
|
||||||
*/
|
|
||||||
refTransform?: boolean;
|
|
||||||
/**
|
|
||||||
* (Experimental) Enable syntax transform for destructuring from defineProps()
|
|
||||||
* https://github.com/vuejs/rfcs/discussions/394
|
|
||||||
* @deprecated now part of `reactivityTransform`
|
|
||||||
* @default false
|
|
||||||
*/
|
|
||||||
propsDestructureTransform?: boolean;
|
|
||||||
/**
|
|
||||||
* @deprecated use `reactivityTransform` instead.
|
|
||||||
*/
|
|
||||||
refSugar?: boolean;
|
|
||||||
/**
|
|
||||||
* Compile the template and inline the resulting render function
|
|
||||||
* directly inside setup().
|
|
||||||
* - Only affects `<script setup>`
|
|
||||||
* - This should only be used in production because it prevents the template
|
|
||||||
* from being hot-reloaded separately from component state.
|
|
||||||
*/
|
|
||||||
inlineTemplate?: boolean;
|
|
||||||
/**
|
|
||||||
* Options for template compilation when inlining. Note these are options that
|
|
||||||
* would normally be passed to `compiler-sfc`'s own `compileTemplate()`, not
|
|
||||||
* options passed to `compiler-dom`.
|
|
||||||
*/
|
|
||||||
templateOptions?: Partial<SFCTemplateCompileOptions>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare interface SFCStyleBlock extends SFCBlock {
|
|
||||||
type: 'style';
|
|
||||||
scoped?: boolean;
|
|
||||||
module?: string | boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare interface SFCStyleCompileOptions {
|
|
||||||
source: string;
|
|
||||||
filename: string;
|
|
||||||
id: string;
|
|
||||||
scoped?: boolean;
|
|
||||||
trim?: boolean;
|
|
||||||
isProd?: boolean;
|
|
||||||
inMap?: RawSourceMap;
|
|
||||||
preprocessLang?: PreprocessLang;
|
|
||||||
preprocessOptions?: any;
|
|
||||||
preprocessCustomRequire?: (id: string) => any;
|
|
||||||
postcssOptions?: any;
|
|
||||||
postcssPlugins?: any[];
|
|
||||||
/**
|
|
||||||
* @deprecated use `inMap` instead.
|
|
||||||
*/
|
|
||||||
map?: RawSourceMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare interface SFCStyleCompileResults {
|
|
||||||
code: string;
|
code: string;
|
||||||
map: RawSourceMap | undefined;
|
ast?: RootNode;
|
||||||
rawResult: Result | LazyResult | undefined;
|
preamble?: string;
|
||||||
errors: Error[];
|
source: string;
|
||||||
modules?: Record<string, string>;
|
tips: string[];
|
||||||
dependencies: Set<string>;
|
errors: (string | CompilerError)[];
|
||||||
|
map?: RawSourceMap;
|
||||||
}
|
}
|
||||||
|
export interface SFCTemplateCompileOptions {
|
||||||
export declare interface SFCTemplateBlock extends SFCBlock {
|
|
||||||
type: 'template';
|
|
||||||
ast: ElementNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare interface SFCTemplateCompileOptions {
|
|
||||||
source: string;
|
source: string;
|
||||||
filename: string;
|
filename: string;
|
||||||
id: string;
|
id: string;
|
||||||
@ -288,30 +65,409 @@ export declare interface SFCTemplateCompileOptions {
|
|||||||
*/
|
*/
|
||||||
transformAssetUrls?: AssetURLOptions | AssetURLTagConfig | boolean;
|
transformAssetUrls?: AssetURLOptions | AssetURLTagConfig | boolean;
|
||||||
}
|
}
|
||||||
|
export declare function compileTemplate(options: SFCTemplateCompileOptions): SFCTemplateCompileResults;
|
||||||
|
|
||||||
export declare interface SFCTemplateCompileResults {
|
export interface SFCScriptCompileOptions {
|
||||||
code: string;
|
/**
|
||||||
ast?: RootNode;
|
* Scope ID for prefixing injected CSS variables.
|
||||||
preamble?: string;
|
* This must be consistent with the `id` passed to `compileStyle`.
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* Production mode. Used to determine whether to generate hashed CSS variables
|
||||||
|
*/
|
||||||
|
isProd?: boolean;
|
||||||
|
/**
|
||||||
|
* Enable/disable source map. Defaults to true.
|
||||||
|
*/
|
||||||
|
sourceMap?: boolean;
|
||||||
|
/**
|
||||||
|
* https://babeljs.io/docs/en/babel-parser#plugins
|
||||||
|
*/
|
||||||
|
babelParserPlugins?: ParserPlugin[];
|
||||||
|
/**
|
||||||
|
* A list of files to parse for global types to be made available for type
|
||||||
|
* resolving in SFC macros. The list must be fully resolved file system paths.
|
||||||
|
*/
|
||||||
|
globalTypeFiles?: string[];
|
||||||
|
/**
|
||||||
|
* Compile the template and inline the resulting render function
|
||||||
|
* directly inside setup().
|
||||||
|
* - Only affects `<script setup>`
|
||||||
|
* - This should only be used in production because it prevents the template
|
||||||
|
* from being hot-reloaded separately from component state.
|
||||||
|
*/
|
||||||
|
inlineTemplate?: boolean;
|
||||||
|
/**
|
||||||
|
* Generate the final component as a variable instead of default export.
|
||||||
|
* This is useful in e.g. @vitejs/plugin-vue where the script needs to be
|
||||||
|
* placed inside the main module.
|
||||||
|
*/
|
||||||
|
genDefaultAs?: string;
|
||||||
|
/**
|
||||||
|
* Options for template compilation when inlining. Note these are options that
|
||||||
|
* would normally be passed to `compiler-sfc`'s own `compileTemplate()`, not
|
||||||
|
* options passed to `compiler-dom`.
|
||||||
|
*/
|
||||||
|
templateOptions?: Partial<SFCTemplateCompileOptions>;
|
||||||
|
/**
|
||||||
|
* Hoist <script setup> static constants.
|
||||||
|
* - Only enables when one `<script setup>` exists.
|
||||||
|
* @default true
|
||||||
|
*/
|
||||||
|
hoistStatic?: boolean;
|
||||||
|
/**
|
||||||
|
* (**Experimental**) Enable macro `defineModel`
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
defineModel?: boolean;
|
||||||
|
/**
|
||||||
|
* (**Experimental**) Enable reactive destructure for `defineProps`
|
||||||
|
* @default false
|
||||||
|
*/
|
||||||
|
propsDestructure?: boolean;
|
||||||
|
/**
|
||||||
|
* File system access methods to be used when resolving types
|
||||||
|
* imported in SFC macros. Defaults to ts.sys in Node.js, can be overwritten
|
||||||
|
* to use a virtual file system for use in browsers (e.g. in REPLs)
|
||||||
|
*/
|
||||||
|
fs?: {
|
||||||
|
fileExists(file: string): boolean;
|
||||||
|
readFile(file: string): string | undefined;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* (Experimental) Enable syntax transform for using refs without `.value` and
|
||||||
|
* using destructured props with reactivity
|
||||||
|
* @deprecated the Reactivity Transform proposal has been dropped. This
|
||||||
|
* feature will be removed from Vue core in 3.4. If you intend to continue
|
||||||
|
* using it, disable this and switch to the [Vue Macros implementation](https://vue-macros.sxzz.moe/features/reactivity-transform.html).
|
||||||
|
*/
|
||||||
|
reactivityTransform?: boolean;
|
||||||
|
}
|
||||||
|
interface ImportBinding {
|
||||||
|
isType: boolean;
|
||||||
|
imported: string;
|
||||||
|
local: string;
|
||||||
source: string;
|
source: string;
|
||||||
tips: string[];
|
isFromSetup: boolean;
|
||||||
errors: (string | CompilerError)[];
|
isUsedInTemplate: boolean;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Compile `<script setup>`
|
||||||
|
* It requires the whole SFC descriptor because we need to handle and merge
|
||||||
|
* normal `<script>` + `<script setup>` if both are present.
|
||||||
|
*/
|
||||||
|
export declare function compileScript(sfc: SFCDescriptor, options: SFCScriptCompileOptions): SFCScriptBlock;
|
||||||
|
|
||||||
|
export interface SFCParseOptions {
|
||||||
|
filename?: string;
|
||||||
|
sourceMap?: boolean;
|
||||||
|
sourceRoot?: string;
|
||||||
|
pad?: boolean | 'line' | 'space';
|
||||||
|
ignoreEmpty?: boolean;
|
||||||
|
compiler?: TemplateCompiler;
|
||||||
|
}
|
||||||
|
export interface SFCBlock {
|
||||||
|
type: string;
|
||||||
|
content: string;
|
||||||
|
attrs: Record<string, string | true>;
|
||||||
|
loc: SourceLocation;
|
||||||
|
map?: RawSourceMap;
|
||||||
|
lang?: string;
|
||||||
|
src?: string;
|
||||||
|
}
|
||||||
|
export interface SFCTemplateBlock extends SFCBlock {
|
||||||
|
type: 'template';
|
||||||
|
ast: ElementNode;
|
||||||
|
}
|
||||||
|
export interface SFCScriptBlock extends SFCBlock {
|
||||||
|
type: 'script';
|
||||||
|
setup?: string | boolean;
|
||||||
|
bindings?: BindingMetadata$1;
|
||||||
|
imports?: Record<string, ImportBinding>;
|
||||||
|
scriptAst?: _babel_types.Statement[];
|
||||||
|
scriptSetupAst?: _babel_types.Statement[];
|
||||||
|
warnings?: string[];
|
||||||
|
/**
|
||||||
|
* Fully resolved dependency file paths (unix slashes) with imported types
|
||||||
|
* used in macros, used for HMR cache busting in @vitejs/plugin-vue and
|
||||||
|
* vue-loader.
|
||||||
|
*/
|
||||||
|
deps?: string[];
|
||||||
|
}
|
||||||
|
export interface SFCStyleBlock extends SFCBlock {
|
||||||
|
type: 'style';
|
||||||
|
scoped?: boolean;
|
||||||
|
module?: string | boolean;
|
||||||
|
}
|
||||||
|
export interface SFCDescriptor {
|
||||||
|
filename: string;
|
||||||
|
source: string;
|
||||||
|
template: SFCTemplateBlock | null;
|
||||||
|
script: SFCScriptBlock | null;
|
||||||
|
scriptSetup: SFCScriptBlock | null;
|
||||||
|
styles: SFCStyleBlock[];
|
||||||
|
customBlocks: SFCBlock[];
|
||||||
|
cssVars: string[];
|
||||||
|
/**
|
||||||
|
* whether the SFC uses :slotted() modifier.
|
||||||
|
* this is used as a compiler optimization hint.
|
||||||
|
*/
|
||||||
|
slotted: boolean;
|
||||||
|
/**
|
||||||
|
* compare with an existing descriptor to determine whether HMR should perform
|
||||||
|
* a reload vs. re-render.
|
||||||
|
*
|
||||||
|
* Note: this comparison assumes the prev/next script are already identical,
|
||||||
|
* and only checks the special case where <script setup lang="ts"> unused import
|
||||||
|
* pruning result changes due to template changes.
|
||||||
|
*/
|
||||||
|
shouldForceReload: (prevImports: Record<string, ImportBinding>) => boolean;
|
||||||
|
}
|
||||||
|
export interface SFCParseResult {
|
||||||
|
descriptor: SFCDescriptor;
|
||||||
|
errors: (CompilerError | SyntaxError)[];
|
||||||
|
}
|
||||||
|
export declare const parseCache: Map<string, SFCParseResult> & {
|
||||||
|
max?: number | undefined;
|
||||||
|
};
|
||||||
|
export declare function parse(source: string, { sourceMap, filename, sourceRoot, pad, ignoreEmpty, compiler }?: SFCParseOptions): SFCParseResult;
|
||||||
|
|
||||||
|
type PreprocessLang = 'less' | 'sass' | 'scss' | 'styl' | 'stylus';
|
||||||
|
|
||||||
|
export interface SFCStyleCompileOptions {
|
||||||
|
source: string;
|
||||||
|
filename: string;
|
||||||
|
id: string;
|
||||||
|
scoped?: boolean;
|
||||||
|
trim?: boolean;
|
||||||
|
isProd?: boolean;
|
||||||
|
inMap?: RawSourceMap;
|
||||||
|
preprocessLang?: PreprocessLang;
|
||||||
|
preprocessOptions?: any;
|
||||||
|
preprocessCustomRequire?: (id: string) => any;
|
||||||
|
postcssOptions?: any;
|
||||||
|
postcssPlugins?: any[];
|
||||||
|
/**
|
||||||
|
* @deprecated use `inMap` instead.
|
||||||
|
*/
|
||||||
map?: RawSourceMap;
|
map?: RawSourceMap;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Aligns with postcss-modules
|
||||||
|
* https://github.com/css-modules/postcss-modules
|
||||||
|
*/
|
||||||
|
interface CSSModulesOptions {
|
||||||
|
scopeBehaviour?: 'global' | 'local';
|
||||||
|
generateScopedName?: string | ((name: string, filename: string, css: string) => string);
|
||||||
|
hashPrefix?: string;
|
||||||
|
localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly';
|
||||||
|
exportGlobals?: boolean;
|
||||||
|
globalModulePaths?: RegExp[];
|
||||||
|
}
|
||||||
|
export interface SFCAsyncStyleCompileOptions extends SFCStyleCompileOptions {
|
||||||
|
isAsync?: boolean;
|
||||||
|
modules?: boolean;
|
||||||
|
modulesOptions?: CSSModulesOptions;
|
||||||
|
}
|
||||||
|
export interface SFCStyleCompileResults {
|
||||||
|
code: string;
|
||||||
|
map: RawSourceMap | undefined;
|
||||||
|
rawResult: Result | LazyResult | undefined;
|
||||||
|
errors: Error[];
|
||||||
|
modules?: Record<string, string>;
|
||||||
|
dependencies: Set<string>;
|
||||||
|
}
|
||||||
|
export declare function compileStyle(options: SFCStyleCompileOptions): SFCStyleCompileResults;
|
||||||
|
export declare function compileStyleAsync(options: SFCAsyncStyleCompileOptions): Promise<SFCStyleCompileResults>;
|
||||||
|
|
||||||
export { shouldTransformRef }
|
export declare function rewriteDefault(input: string, as: string, parserPlugins?: ParserPlugin[]): string;
|
||||||
|
/**
|
||||||
|
* Utility for rewriting `export default` in a script block into a variable
|
||||||
|
* declaration so that we can inject things into it
|
||||||
|
*/
|
||||||
|
export declare function rewriteDefaultAST(ast: Statement[], s: MagicString, as: string): void;
|
||||||
|
|
||||||
export declare interface TemplateCompiler {
|
type PropsDestructureBindings = Record<string, // public prop key
|
||||||
compile(template: string, options: CompilerOptions): CodegenResult;
|
{
|
||||||
parse(template: string, options: ParserOptions): RootNode;
|
local: string;
|
||||||
|
default?: Expression;
|
||||||
|
}>;
|
||||||
|
|
||||||
|
interface ModelDecl {
|
||||||
|
type: TSType | undefined;
|
||||||
|
options: string | undefined;
|
||||||
|
identifier: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { transformRef }
|
declare const enum BindingTypes {
|
||||||
|
/**
|
||||||
|
* returned from data()
|
||||||
|
*/
|
||||||
|
DATA = "data",
|
||||||
|
/**
|
||||||
|
* declared as a prop
|
||||||
|
*/
|
||||||
|
PROPS = "props",
|
||||||
|
/**
|
||||||
|
* a local alias of a `<script setup>` destructured prop.
|
||||||
|
* the original is stored in __propsAliases of the bindingMetadata object.
|
||||||
|
*/
|
||||||
|
PROPS_ALIASED = "props-aliased",
|
||||||
|
/**
|
||||||
|
* a let binding (may or may not be a ref)
|
||||||
|
*/
|
||||||
|
SETUP_LET = "setup-let",
|
||||||
|
/**
|
||||||
|
* a const binding that can never be a ref.
|
||||||
|
* these bindings don't need `unref()` calls when processed in inlined
|
||||||
|
* template expressions.
|
||||||
|
*/
|
||||||
|
SETUP_CONST = "setup-const",
|
||||||
|
/**
|
||||||
|
* a const binding that does not need `unref()`, but may be mutated.
|
||||||
|
*/
|
||||||
|
SETUP_REACTIVE_CONST = "setup-reactive-const",
|
||||||
|
/**
|
||||||
|
* a const binding that may be a ref.
|
||||||
|
*/
|
||||||
|
SETUP_MAYBE_REF = "setup-maybe-ref",
|
||||||
|
/**
|
||||||
|
* bindings that are guaranteed to be refs
|
||||||
|
*/
|
||||||
|
SETUP_REF = "setup-ref",
|
||||||
|
/**
|
||||||
|
* declared by other options, e.g. computed, inject
|
||||||
|
*/
|
||||||
|
OPTIONS = "options",
|
||||||
|
/**
|
||||||
|
* a literal constant, e.g. 'foo', 1, true
|
||||||
|
*/
|
||||||
|
LITERAL_CONST = "literal-const"
|
||||||
|
}
|
||||||
|
type BindingMetadata = {
|
||||||
|
[key: string]: BindingTypes | undefined;
|
||||||
|
} & {
|
||||||
|
__isScriptSetup?: boolean;
|
||||||
|
__propsAliases?: Record<string, string>;
|
||||||
|
};
|
||||||
|
|
||||||
export { transformRefAST }
|
export declare class ScriptCompileContext {
|
||||||
|
descriptor: SFCDescriptor;
|
||||||
|
options: Partial<SFCScriptCompileOptions>;
|
||||||
|
isJS: boolean;
|
||||||
|
isTS: boolean;
|
||||||
|
scriptAst: Program | null;
|
||||||
|
scriptSetupAst: Program | null;
|
||||||
|
source: string;
|
||||||
|
filename: string;
|
||||||
|
s: MagicString;
|
||||||
|
startOffset: number | undefined;
|
||||||
|
endOffset: number | undefined;
|
||||||
|
scope?: TypeScope;
|
||||||
|
globalScopes?: TypeScope[];
|
||||||
|
userImports: Record<string, ImportBinding>;
|
||||||
|
hasDefinePropsCall: boolean;
|
||||||
|
hasDefineEmitCall: boolean;
|
||||||
|
hasDefineExposeCall: boolean;
|
||||||
|
hasDefaultExportName: boolean;
|
||||||
|
hasDefaultExportRender: boolean;
|
||||||
|
hasDefineOptionsCall: boolean;
|
||||||
|
hasDefineSlotsCall: boolean;
|
||||||
|
hasDefineModelCall: boolean;
|
||||||
|
propsIdentifier: string | undefined;
|
||||||
|
propsRuntimeDecl: Node | undefined;
|
||||||
|
propsTypeDecl: Node | undefined;
|
||||||
|
propsDestructureDecl: ObjectPattern | undefined;
|
||||||
|
propsDestructuredBindings: PropsDestructureBindings;
|
||||||
|
propsDestructureRestId: string | undefined;
|
||||||
|
propsRuntimeDefaults: Node | undefined;
|
||||||
|
emitsRuntimeDecl: Node | undefined;
|
||||||
|
emitsTypeDecl: Node | undefined;
|
||||||
|
emitIdentifier: string | undefined;
|
||||||
|
modelDecls: Record<string, ModelDecl>;
|
||||||
|
optionsRuntimeDecl: Node | undefined;
|
||||||
|
bindingMetadata: BindingMetadata;
|
||||||
|
helperImports: Set<string>;
|
||||||
|
helper(key: string): string;
|
||||||
|
/**
|
||||||
|
* to be exposed on compiled script block for HMR cache busting
|
||||||
|
*/
|
||||||
|
deps?: Set<string>;
|
||||||
|
/**
|
||||||
|
* cache for resolved fs
|
||||||
|
*/
|
||||||
|
fs?: NonNullable<SFCScriptCompileOptions['fs']>;
|
||||||
|
constructor(descriptor: SFCDescriptor, options: Partial<SFCScriptCompileOptions>);
|
||||||
|
getString(node: Node, scriptSetup?: boolean): string;
|
||||||
|
error(msg: string, node: Node, scope?: TypeScope): never;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TypeResolveContext is compatible with ScriptCompileContext
|
||||||
|
* but also allows a simpler version of it with minimal required properties
|
||||||
|
* when resolveType needs to be used in a non-SFC context, e.g. in a babel
|
||||||
|
* plugin. The simplest context can be just:
|
||||||
|
* ```ts
|
||||||
|
* const ctx: SimpleTypeResolveContext = {
|
||||||
|
* filename: '...',
|
||||||
|
* source: '...',
|
||||||
|
* options: {},
|
||||||
|
* error() {},
|
||||||
|
* ast: []
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
export type SimpleTypeResolveContext = Pick<ScriptCompileContext, 'source' | 'filename' | 'error' | 'options'> & Partial<Pick<ScriptCompileContext, 'scope' | 'globalScopes' | 'deps' | 'fs'>> & {
|
||||||
|
ast: Statement[];
|
||||||
|
};
|
||||||
|
export type TypeResolveContext = ScriptCompileContext | SimpleTypeResolveContext;
|
||||||
|
type Import = Pick<ImportBinding, 'source' | 'imported'>;
|
||||||
|
interface WithScope {
|
||||||
|
_ownerScope: TypeScope;
|
||||||
|
}
|
||||||
|
type ScopeTypeNode = Node & WithScope & {
|
||||||
|
_ns?: TSModuleDeclaration & WithScope;
|
||||||
|
};
|
||||||
|
declare class TypeScope {
|
||||||
|
filename: string;
|
||||||
|
source: string;
|
||||||
|
offset: number;
|
||||||
|
imports: Record<string, Import>;
|
||||||
|
types: Record<string, ScopeTypeNode>;
|
||||||
|
declares: Record<string, ScopeTypeNode>;
|
||||||
|
constructor(filename: string, source: string, offset?: number, imports?: Record<string, Import>, types?: Record<string, ScopeTypeNode>, declares?: Record<string, ScopeTypeNode>);
|
||||||
|
resolvedImportSources: Record<string, string>;
|
||||||
|
exportedTypes: Record<string, ScopeTypeNode>;
|
||||||
|
exportedDeclares: Record<string, ScopeTypeNode>;
|
||||||
|
}
|
||||||
|
interface MaybeWithScope {
|
||||||
|
_ownerScope?: TypeScope;
|
||||||
|
}
|
||||||
|
interface ResolvedElements {
|
||||||
|
props: Record<string, (TSPropertySignature | TSMethodSignature) & {
|
||||||
|
_ownerScope: TypeScope;
|
||||||
|
}>;
|
||||||
|
calls?: (TSCallSignatureDeclaration | TSFunctionType)[];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Resolve arbitrary type node to a list of type elements that can be then
|
||||||
|
* mapped to runtime props or emits.
|
||||||
|
*/
|
||||||
|
export declare function resolveTypeElements(ctx: TypeResolveContext, node: Node & MaybeWithScope & {
|
||||||
|
_resolvedElements?: ResolvedElements;
|
||||||
|
}, scope?: TypeScope): ResolvedElements;
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
export declare function registerTS(_ts: any): void;
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
export declare function invalidateTypeCache(filename: string): void;
|
||||||
|
export declare function inferRuntimeType(ctx: TypeResolveContext, node: Node & MaybeWithScope, scope?: TypeScope): string[];
|
||||||
|
|
||||||
|
export declare const version: string;
|
||||||
|
|
||||||
export declare const walk: any;
|
export declare const walk: any;
|
||||||
|
|
||||||
export { walkIdentifiers }
|
|
||||||
|
|
||||||
export { }
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vue/compiler-sfc",
|
"name": "@vue/compiler-sfc",
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"description": "@vue/compiler-sfc",
|
"description": "@vue/compiler-sfc",
|
||||||
"main": "dist/compiler-sfc.cjs.js",
|
"main": "dist/compiler-sfc.cjs.js",
|
||||||
"module": "dist/compiler-sfc.esm-browser.js",
|
"module": "dist/compiler-sfc.esm-browser.js",
|
||||||
@ -32,28 +32,29 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-sfc#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/parser": "^7.16.4",
|
"@babel/parser": "^7.20.15",
|
||||||
"@vue/compiler-core": "3.2.45",
|
"@vue/compiler-core": "3.3.4",
|
||||||
"@vue/compiler-dom": "3.2.45",
|
"@vue/compiler-dom": "3.3.4",
|
||||||
"@vue/compiler-ssr": "3.2.45",
|
"@vue/compiler-ssr": "3.3.4",
|
||||||
"@vue/reactivity-transform": "3.2.45",
|
"@vue/reactivity-transform": "3.3.4",
|
||||||
"@vue/shared": "3.2.45",
|
"@vue/shared": "3.3.4",
|
||||||
"estree-walker": "^2.0.2",
|
"estree-walker": "^2.0.2",
|
||||||
"magic-string": "^0.25.7",
|
"magic-string": "^0.30.0",
|
||||||
"source-map": "^0.6.1",
|
"postcss": "^8.1.10",
|
||||||
"postcss": "^8.1.10"
|
"source-map-js": "^1.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@babel/types": "^7.21.3",
|
||||||
"@types/estree": "^0.0.48",
|
"@types/estree": "^0.0.48",
|
||||||
"@babel/types": "^7.16.0",
|
|
||||||
"@types/lru-cache": "^5.1.0",
|
"@types/lru-cache": "^5.1.0",
|
||||||
"pug": "^3.0.1",
|
|
||||||
"sass": "^1.26.9",
|
|
||||||
"@vue/consolidate": "^0.17.3",
|
"@vue/consolidate": "^0.17.3",
|
||||||
"hash-sum": "^2.0.0",
|
"hash-sum": "^2.0.0",
|
||||||
"lru-cache": "^5.1.1",
|
"lru-cache": "^5.1.1",
|
||||||
"merge-source-map": "^1.1.0",
|
"merge-source-map": "^1.1.0",
|
||||||
|
"minimatch": "^9.0.0",
|
||||||
"postcss-modules": "^4.0.0",
|
"postcss-modules": "^4.0.0",
|
||||||
"postcss-selector-parser": "^6.0.4"
|
"postcss-selector-parser": "^6.0.4",
|
||||||
|
"pug": "^3.0.1",
|
||||||
|
"sass": "^1.26.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,4 @@
|
|||||||
import { CodegenResult } from '@vue/compiler-dom';
|
import { CompilerOptions, CodegenResult } from '@vue/compiler-dom';
|
||||||
import { CompilerOptions } from '@vue/compiler-dom';
|
|
||||||
|
|
||||||
export declare function compile(template: string, options?: CompilerOptions): CodegenResult;
|
export declare function compile(template: string, options?: CompilerOptions): CodegenResult;
|
||||||
|
|
||||||
export { }
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vue/compiler-ssr",
|
"name": "@vue/compiler-ssr",
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"description": "@vue/compiler-ssr",
|
"description": "@vue/compiler-ssr",
|
||||||
"main": "dist/compiler-ssr.cjs.js",
|
"main": "dist/compiler-ssr.cjs.js",
|
||||||
"types": "dist/compiler-ssr.d.ts",
|
"types": "dist/compiler-ssr.d.ts",
|
||||||
@ -28,7 +28,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-ssr#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/shared": "3.2.45",
|
"@vue/shared": "3.3.4",
|
||||||
"@vue/compiler-dom": "3.2.45"
|
"@vue/compiler-dom": "3.3.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,8 +1,10 @@
|
|||||||
# @vue/reactivity-transform
|
# @vue/reactivity-transform
|
||||||
|
|
||||||
> ⚠️ This is experimental and currently only provided for testing and feedback. It may break during patches or even be removed. Use at your own risk!
|
> ⚠️ This is experimental and the proposal has been dropped.
|
||||||
|
> The feature is now marked as deprecated and will be removed from Vue core
|
||||||
|
> in 3.4.
|
||||||
>
|
>
|
||||||
> Follow https://github.com/vuejs/rfcs/discussions/369 for details and updates.
|
> See reason for deprecation [here](https://github.com/vuejs/rfcs/discussions/369#discussioncomment-5059028).
|
||||||
|
|
||||||
## Basic Rules
|
## Basic Rules
|
||||||
|
|
||||||
|
@ -8,101 +8,103 @@ var compilerCore = require('@vue/compiler-core');
|
|||||||
var parser = require('@babel/parser');
|
var parser = require('@babel/parser');
|
||||||
var shared = require('@vue/shared');
|
var shared = require('@vue/shared');
|
||||||
|
|
||||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
|
const CONVERT_SYMBOL = "$";
|
||||||
|
const ESCAPE_SYMBOL = "$$";
|
||||||
var MagicString__default = /*#__PURE__*/_interopDefaultLegacy(MagicString);
|
const IMPORT_SOURCE = "vue/macros";
|
||||||
|
const shorthands = ["ref", "computed", "shallowRef", "toRef", "customRef"];
|
||||||
const CONVERT_SYMBOL = '$';
|
|
||||||
const ESCAPE_SYMBOL = '$$';
|
|
||||||
const IMPORT_SOURCE = 'vue/macros';
|
|
||||||
const shorthands = ['ref', 'computed', 'shallowRef', 'toRef', 'customRef'];
|
|
||||||
const transformCheckRE = /[^\w]\$(?:\$|ref|computed|shallowRef)?\s*(\(|\<)/;
|
const transformCheckRE = /[^\w]\$(?:\$|ref|computed|shallowRef)?\s*(\(|\<)/;
|
||||||
function shouldTransform(src) {
|
function shouldTransform(src) {
|
||||||
return transformCheckRE.test(src);
|
return transformCheckRE.test(src);
|
||||||
}
|
}
|
||||||
function transform(src, { filename, sourceMap, parserPlugins, importHelpersFrom = 'vue' } = {}) {
|
function transform(src, {
|
||||||
|
filename,
|
||||||
|
sourceMap,
|
||||||
|
parserPlugins,
|
||||||
|
importHelpersFrom = "vue"
|
||||||
|
} = {}) {
|
||||||
const plugins = parserPlugins || [];
|
const plugins = parserPlugins || [];
|
||||||
if (filename) {
|
if (filename) {
|
||||||
if (/\.tsx?$/.test(filename)) {
|
if (/\.tsx?$/.test(filename)) {
|
||||||
plugins.push('typescript');
|
plugins.push("typescript");
|
||||||
}
|
}
|
||||||
if (filename.endsWith('x')) {
|
if (filename.endsWith("x")) {
|
||||||
plugins.push('jsx');
|
plugins.push("jsx");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const ast = parser.parse(src, {
|
const ast = parser.parse(src, {
|
||||||
sourceType: 'module',
|
sourceType: "module",
|
||||||
plugins
|
plugins
|
||||||
});
|
});
|
||||||
const s = new MagicString__default(src);
|
const s = new MagicString(src);
|
||||||
const res = transformAST(ast.program, s, 0);
|
const res = transformAST(ast.program, s, 0);
|
||||||
// inject helper imports
|
|
||||||
if (res.importedHelpers.length) {
|
if (res.importedHelpers.length) {
|
||||||
s.prepend(`import { ${res.importedHelpers
|
s.prepend(
|
||||||
.map(h => `${h} as _${h}`)
|
`import { ${res.importedHelpers.map((h) => `${h} as _${h}`).join(", ")} } from '${importHelpersFrom}'
|
||||||
.join(', ')} } from '${importHelpersFrom}'\n`);
|
`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
...res,
|
...res,
|
||||||
code: s.toString(),
|
code: s.toString(),
|
||||||
map: sourceMap
|
map: sourceMap ? s.generateMap({
|
||||||
? s.generateMap({
|
|
||||||
source: filename,
|
source: filename,
|
||||||
hires: true,
|
hires: true,
|
||||||
includeContent: true
|
includeContent: true
|
||||||
})
|
}) : null
|
||||||
: null
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function transformAST(ast, s, offset = 0, knownRefs, knownProps) {
|
function transformAST(ast, s, offset = 0, knownRefs, knownProps) {
|
||||||
// TODO remove when out of experimental
|
|
||||||
warnExperimental();
|
warnExperimental();
|
||||||
const userImports = Object.create(null);
|
const userImports = /* @__PURE__ */ Object.create(null);
|
||||||
for (const node of ast.body) {
|
for (const node of ast.body) {
|
||||||
if (node.type !== 'ImportDeclaration')
|
if (node.type !== "ImportDeclaration")
|
||||||
continue;
|
continue;
|
||||||
walkImportDeclaration(node);
|
walkImportDeclaration(node);
|
||||||
}
|
}
|
||||||
// macro import handling
|
|
||||||
let convertSymbol;
|
let convertSymbol;
|
||||||
let escapeSymbol;
|
let escapeSymbol;
|
||||||
for (const { local, imported, source, specifier } of Object.values(userImports)) {
|
for (const { local, imported, source, specifier } of Object.values(
|
||||||
|
userImports
|
||||||
|
)) {
|
||||||
if (source === IMPORT_SOURCE) {
|
if (source === IMPORT_SOURCE) {
|
||||||
if (imported === ESCAPE_SYMBOL) {
|
if (imported === ESCAPE_SYMBOL) {
|
||||||
escapeSymbol = local;
|
escapeSymbol = local;
|
||||||
}
|
} else if (imported === CONVERT_SYMBOL) {
|
||||||
else if (imported === CONVERT_SYMBOL) {
|
|
||||||
convertSymbol = local;
|
convertSymbol = local;
|
||||||
}
|
} else if (imported !== local) {
|
||||||
else if (imported !== local) {
|
error(
|
||||||
error(`macro imports for ref-creating methods do not support aliasing.`, specifier);
|
`macro imports for ref-creating methods do not support aliasing.`,
|
||||||
|
specifier
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// default symbol
|
|
||||||
if (!convertSymbol && !userImports[CONVERT_SYMBOL]) {
|
if (!convertSymbol && !userImports[CONVERT_SYMBOL]) {
|
||||||
convertSymbol = CONVERT_SYMBOL;
|
convertSymbol = CONVERT_SYMBOL;
|
||||||
}
|
}
|
||||||
if (!escapeSymbol && !userImports[ESCAPE_SYMBOL]) {
|
if (!escapeSymbol && !userImports[ESCAPE_SYMBOL]) {
|
||||||
escapeSymbol = ESCAPE_SYMBOL;
|
escapeSymbol = ESCAPE_SYMBOL;
|
||||||
}
|
}
|
||||||
const importedHelpers = new Set();
|
const importedHelpers = /* @__PURE__ */ new Set();
|
||||||
const rootScope = {};
|
const rootScope = {};
|
||||||
const scopeStack = [rootScope];
|
const scopeStack = [rootScope];
|
||||||
let currentScope = rootScope;
|
let currentScope = rootScope;
|
||||||
let escapeScope; // inside $$()
|
let escapeScope;
|
||||||
const excludedIds = new WeakSet();
|
const excludedIds = /* @__PURE__ */ new WeakSet();
|
||||||
const parentStack = [];
|
const parentStack = [];
|
||||||
const propsLocalToPublicMap = Object.create(null);
|
const propsLocalToPublicMap = /* @__PURE__ */ Object.create(null);
|
||||||
if (knownRefs) {
|
if (knownRefs) {
|
||||||
for (const key of knownRefs) {
|
for (const key of knownRefs) {
|
||||||
rootScope[key] = true;
|
rootScope[key] = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (knownProps) {
|
if (knownProps) {
|
||||||
for (const key in knownProps) {
|
for (const key in knownProps) {
|
||||||
const { local } = knownProps[key];
|
const { local, isConst } = knownProps[key];
|
||||||
rootScope[local] = 'prop';
|
rootScope[local] = {
|
||||||
|
isProp: true,
|
||||||
|
isConst: !!isConst
|
||||||
|
};
|
||||||
propsLocalToPublicMap[local] = key;
|
propsLocalToPublicMap[local] = key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,10 +115,7 @@ function transformAST(ast, s, offset = 0, knownRefs, knownProps) {
|
|||||||
}
|
}
|
||||||
for (const specifier of node.specifiers) {
|
for (const specifier of node.specifiers) {
|
||||||
const local = specifier.local.name;
|
const local = specifier.local.name;
|
||||||
const imported = (specifier.type === 'ImportSpecifier' &&
|
const imported = specifier.type === "ImportSpecifier" && specifier.imported.type === "Identifier" && specifier.imported.name || "default";
|
||||||
specifier.imported.type === 'Identifier' &&
|
|
||||||
specifier.imported.name) ||
|
|
||||||
'default';
|
|
||||||
userImports[local] = {
|
userImports[local] = {
|
||||||
source,
|
source,
|
||||||
local,
|
local,
|
||||||
@ -126,13 +125,13 @@ function transformAST(ast, s, offset = 0, knownRefs, knownProps) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function isRefCreationCall(callee) {
|
function isRefCreationCall(callee) {
|
||||||
if (!convertSymbol || currentScope[convertSymbol] !== undefined) {
|
if (!convertSymbol || currentScope[convertSymbol] !== void 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (callee === convertSymbol) {
|
if (callee === convertSymbol) {
|
||||||
return convertSymbol;
|
return convertSymbol;
|
||||||
}
|
}
|
||||||
if (callee[0] === '$' && shorthands.includes(callee.slice(1))) {
|
if (callee[0] === "$" && shorthands.includes(callee.slice(1))) {
|
||||||
return callee;
|
return callee;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -146,16 +145,18 @@ function transformAST(ast, s, offset = 0, knownRefs, knownProps) {
|
|||||||
importedHelpers.add(msg);
|
importedHelpers.add(msg);
|
||||||
return `_${msg}`;
|
return `_${msg}`;
|
||||||
}
|
}
|
||||||
function registerBinding(id, isRef = false) {
|
function registerBinding(id, binding) {
|
||||||
excludedIds.add(id);
|
excludedIds.add(id);
|
||||||
if (currentScope) {
|
if (currentScope) {
|
||||||
currentScope[id.name] = isRef;
|
currentScope[id.name] = binding ? binding : false;
|
||||||
}
|
} else {
|
||||||
else {
|
error(
|
||||||
error('registerBinding called without active scope, something is wrong.', id);
|
"registerBinding called without active scope, something is wrong.",
|
||||||
|
id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const registerRefBinding = (id) => registerBinding(id, true);
|
const registerRefBinding = (id, isConst = false) => registerBinding(id, { isConst });
|
||||||
let tempVarCount = 0;
|
let tempVarCount = 0;
|
||||||
function genTempVar() {
|
function genTempVar() {
|
||||||
return `__$temp_${++tempVarCount}`;
|
return `__$temp_${++tempVarCount}`;
|
||||||
@ -165,26 +166,17 @@ function transformAST(ast, s, offset = 0, knownRefs, knownProps) {
|
|||||||
}
|
}
|
||||||
function walkScope(node, isRoot = false) {
|
function walkScope(node, isRoot = false) {
|
||||||
for (const stmt of node.body) {
|
for (const stmt of node.body) {
|
||||||
if (stmt.type === 'VariableDeclaration') {
|
if (stmt.type === "VariableDeclaration") {
|
||||||
walkVariableDeclaration(stmt, isRoot);
|
walkVariableDeclaration(stmt, isRoot);
|
||||||
}
|
} else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") {
|
||||||
else if (stmt.type === 'FunctionDeclaration' ||
|
|
||||||
stmt.type === 'ClassDeclaration') {
|
|
||||||
if (stmt.declare || !stmt.id)
|
if (stmt.declare || !stmt.id)
|
||||||
continue;
|
continue;
|
||||||
registerBinding(stmt.id);
|
registerBinding(stmt.id);
|
||||||
}
|
} else if ((stmt.type === "ForOfStatement" || stmt.type === "ForInStatement") && stmt.left.type === "VariableDeclaration") {
|
||||||
else if ((stmt.type === 'ForOfStatement' || stmt.type === 'ForInStatement') &&
|
|
||||||
stmt.left.type === 'VariableDeclaration') {
|
|
||||||
walkVariableDeclaration(stmt.left);
|
walkVariableDeclaration(stmt.left);
|
||||||
}
|
} else if (stmt.type === "ExportNamedDeclaration" && stmt.declaration && stmt.declaration.type === "VariableDeclaration") {
|
||||||
else if (stmt.type === 'ExportNamedDeclaration' &&
|
|
||||||
stmt.declaration &&
|
|
||||||
stmt.declaration.type === 'VariableDeclaration') {
|
|
||||||
walkVariableDeclaration(stmt.declaration, isRoot);
|
walkVariableDeclaration(stmt.declaration, isRoot);
|
||||||
}
|
} else if (stmt.type === "LabeledStatement" && stmt.body.type === "VariableDeclaration") {
|
||||||
else if (stmt.type === 'LabeledStatement' &&
|
|
||||||
stmt.body.type === 'VariableDeclaration') {
|
|
||||||
walkVariableDeclaration(stmt.body, isRoot);
|
walkVariableDeclaration(stmt.body, isRoot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,140 +187,122 @@ function transformAST(ast, s, offset = 0, knownRefs, knownProps) {
|
|||||||
}
|
}
|
||||||
for (const decl of stmt.declarations) {
|
for (const decl of stmt.declarations) {
|
||||||
let refCall;
|
let refCall;
|
||||||
const isCall = decl.init &&
|
const isCall = decl.init && decl.init.type === "CallExpression" && decl.init.callee.type === "Identifier";
|
||||||
decl.init.type === 'CallExpression' &&
|
if (isCall && (refCall = isRefCreationCall(decl.init.callee.name))) {
|
||||||
decl.init.callee.type === 'Identifier';
|
processRefDeclaration(
|
||||||
if (isCall &&
|
refCall,
|
||||||
(refCall = isRefCreationCall(decl.init.callee.name))) {
|
decl.id,
|
||||||
processRefDeclaration(refCall, decl.id, decl.init);
|
decl.init,
|
||||||
}
|
stmt.kind === "const"
|
||||||
else {
|
);
|
||||||
const isProps = isRoot && isCall && decl.init.callee.name === 'defineProps';
|
} else {
|
||||||
|
const isProps = isRoot && isCall && decl.init.callee.name === "defineProps";
|
||||||
for (const id of compilerCore.extractIdentifiers(decl.id)) {
|
for (const id of compilerCore.extractIdentifiers(decl.id)) {
|
||||||
if (isProps) {
|
if (isProps) {
|
||||||
// for defineProps destructure, only exclude them since they
|
|
||||||
// are already passed in as knownProps
|
|
||||||
excludedIds.add(id);
|
excludedIds.add(id);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
registerBinding(id);
|
registerBinding(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function processRefDeclaration(method, id, call) {
|
function processRefDeclaration(method, id, call, isConst) {
|
||||||
excludedIds.add(call.callee);
|
excludedIds.add(call.callee);
|
||||||
if (method === convertSymbol) {
|
if (method === convertSymbol) {
|
||||||
// $
|
|
||||||
// remove macro
|
|
||||||
s.remove(call.callee.start + offset, call.callee.end + offset);
|
s.remove(call.callee.start + offset, call.callee.end + offset);
|
||||||
if (id.type === 'Identifier') {
|
if (id.type === "Identifier") {
|
||||||
// single variable
|
registerRefBinding(id, isConst);
|
||||||
registerRefBinding(id);
|
} else if (id.type === "ObjectPattern") {
|
||||||
|
processRefObjectPattern(id, call, isConst);
|
||||||
|
} else if (id.type === "ArrayPattern") {
|
||||||
|
processRefArrayPattern(id, call, isConst);
|
||||||
}
|
}
|
||||||
else if (id.type === 'ObjectPattern') {
|
} else {
|
||||||
processRefObjectPattern(id, call);
|
if (id.type === "Identifier") {
|
||||||
}
|
registerRefBinding(id, isConst);
|
||||||
else if (id.type === 'ArrayPattern') {
|
s.overwrite(
|
||||||
processRefArrayPattern(id, call);
|
call.start + offset,
|
||||||
}
|
call.start + method.length + offset,
|
||||||
}
|
helper(method.slice(1))
|
||||||
else {
|
);
|
||||||
// shorthands
|
} else {
|
||||||
if (id.type === 'Identifier') {
|
|
||||||
registerRefBinding(id);
|
|
||||||
// replace call
|
|
||||||
s.overwrite(call.start + offset, call.start + method.length + offset, helper(method.slice(1)));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
error(`${method}() cannot be used with destructure patterns.`, call);
|
error(`${method}() cannot be used with destructure patterns.`, call);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function processRefObjectPattern(pattern, call, tempVar, path = []) {
|
function processRefObjectPattern(pattern, call, isConst, tempVar, path = []) {
|
||||||
if (!tempVar) {
|
if (!tempVar) {
|
||||||
tempVar = genTempVar();
|
tempVar = genTempVar();
|
||||||
// const { x } = $(useFoo()) --> const __$temp_1 = useFoo()
|
|
||||||
s.overwrite(pattern.start + offset, pattern.end + offset, tempVar);
|
s.overwrite(pattern.start + offset, pattern.end + offset, tempVar);
|
||||||
}
|
}
|
||||||
let nameId;
|
let nameId;
|
||||||
for (const p of pattern.properties) {
|
for (const p of pattern.properties) {
|
||||||
let key;
|
let key;
|
||||||
let defaultValue;
|
let defaultValue;
|
||||||
if (p.type === 'ObjectProperty') {
|
if (p.type === "ObjectProperty") {
|
||||||
if (p.key.start === p.value.start) {
|
if (p.key.start === p.value.start) {
|
||||||
// shorthand { foo }
|
|
||||||
nameId = p.key;
|
nameId = p.key;
|
||||||
if (p.value.type === 'Identifier') {
|
if (p.value.type === "Identifier") {
|
||||||
// avoid shorthand value identifier from being processed
|
|
||||||
excludedIds.add(p.value);
|
excludedIds.add(p.value);
|
||||||
}
|
} else if (p.value.type === "AssignmentPattern" && p.value.left.type === "Identifier") {
|
||||||
else if (p.value.type === 'AssignmentPattern' &&
|
|
||||||
p.value.left.type === 'Identifier') {
|
|
||||||
// { foo = 1 }
|
|
||||||
excludedIds.add(p.value.left);
|
excludedIds.add(p.value.left);
|
||||||
defaultValue = p.value.right;
|
defaultValue = p.value.right;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
key = p.computed ? p.key : p.key.name;
|
key = p.computed ? p.key : p.key.name;
|
||||||
if (p.value.type === 'Identifier') {
|
if (p.value.type === "Identifier") {
|
||||||
// { foo: bar }
|
|
||||||
nameId = p.value;
|
nameId = p.value;
|
||||||
}
|
} else if (p.value.type === "ObjectPattern") {
|
||||||
else if (p.value.type === 'ObjectPattern') {
|
processRefObjectPattern(p.value, call, isConst, tempVar, [
|
||||||
processRefObjectPattern(p.value, call, tempVar, [...path, key]);
|
...path,
|
||||||
}
|
key
|
||||||
else if (p.value.type === 'ArrayPattern') {
|
]);
|
||||||
processRefArrayPattern(p.value, call, tempVar, [...path, key]);
|
} else if (p.value.type === "ArrayPattern") {
|
||||||
}
|
processRefArrayPattern(p.value, call, isConst, tempVar, [
|
||||||
else if (p.value.type === 'AssignmentPattern') {
|
...path,
|
||||||
if (p.value.left.type === 'Identifier') {
|
key
|
||||||
// { foo: bar = 1 }
|
]);
|
||||||
|
} else if (p.value.type === "AssignmentPattern") {
|
||||||
|
if (p.value.left.type === "Identifier") {
|
||||||
nameId = p.value.left;
|
nameId = p.value.left;
|
||||||
defaultValue = p.value.right;
|
defaultValue = p.value.right;
|
||||||
}
|
} else if (p.value.left.type === "ObjectPattern") {
|
||||||
else if (p.value.left.type === 'ObjectPattern') {
|
processRefObjectPattern(p.value.left, call, isConst, tempVar, [
|
||||||
processRefObjectPattern(p.value.left, call, tempVar, [
|
|
||||||
...path,
|
...path,
|
||||||
[key, p.value.right]
|
[key, p.value.right]
|
||||||
]);
|
]);
|
||||||
}
|
} else if (p.value.left.type === "ArrayPattern") {
|
||||||
else if (p.value.left.type === 'ArrayPattern') {
|
processRefArrayPattern(p.value.left, call, isConst, tempVar, [
|
||||||
processRefArrayPattern(p.value.left, call, tempVar, [
|
|
||||||
...path,
|
...path,
|
||||||
[key, p.value.right]
|
[key, p.value.right]
|
||||||
]);
|
]);
|
||||||
}
|
} else ;
|
||||||
else ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// rest element { ...foo }
|
|
||||||
error(`reactivity destructure does not support rest elements.`, p);
|
error(`reactivity destructure does not support rest elements.`, p);
|
||||||
}
|
}
|
||||||
if (nameId) {
|
if (nameId) {
|
||||||
registerRefBinding(nameId);
|
registerRefBinding(nameId, isConst);
|
||||||
// inject toRef() after original replaced pattern
|
|
||||||
const source = pathToString(tempVar, path);
|
const source = pathToString(tempVar, path);
|
||||||
const keyStr = shared.isString(key)
|
const keyStr = shared.isString(key) ? `'${key}'` : key ? snip(key) : `'${nameId.name}'`;
|
||||||
? `'${key}'`
|
|
||||||
: key
|
|
||||||
? snip(key)
|
|
||||||
: `'${nameId.name}'`;
|
|
||||||
const defaultStr = defaultValue ? `, ${snip(defaultValue)}` : ``;
|
const defaultStr = defaultValue ? `, ${snip(defaultValue)}` : ``;
|
||||||
s.appendLeft(call.end + offset, `,\n ${nameId.name} = ${helper('toRef')}(${source}, ${keyStr}${defaultStr})`);
|
s.appendLeft(
|
||||||
|
call.end + offset,
|
||||||
|
`,
|
||||||
|
${nameId.name} = ${helper(
|
||||||
|
"toRef"
|
||||||
|
)}(${source}, ${keyStr}${defaultStr})`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nameId) {
|
if (nameId) {
|
||||||
s.appendLeft(call.end + offset, ';');
|
s.appendLeft(call.end + offset, ";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function processRefArrayPattern(pattern, call, tempVar, path = []) {
|
function processRefArrayPattern(pattern, call, isConst, tempVar, path = []) {
|
||||||
if (!tempVar) {
|
if (!tempVar) {
|
||||||
// const [x] = $(useFoo()) --> const __$temp_1 = useFoo()
|
|
||||||
tempVar = genTempVar();
|
tempVar = genTempVar();
|
||||||
s.overwrite(pattern.start + offset, pattern.end + offset, tempVar);
|
s.overwrite(pattern.start + offset, pattern.end + offset, tempVar);
|
||||||
}
|
}
|
||||||
@ -338,35 +312,33 @@ function transformAST(ast, s, offset = 0, knownRefs, knownProps) {
|
|||||||
if (!e)
|
if (!e)
|
||||||
continue;
|
continue;
|
||||||
let defaultValue;
|
let defaultValue;
|
||||||
if (e.type === 'Identifier') {
|
if (e.type === "Identifier") {
|
||||||
// [a] --> [__a]
|
|
||||||
nameId = e;
|
nameId = e;
|
||||||
}
|
} else if (e.type === "AssignmentPattern") {
|
||||||
else if (e.type === 'AssignmentPattern') {
|
|
||||||
// [a = 1]
|
|
||||||
nameId = e.left;
|
nameId = e.left;
|
||||||
defaultValue = e.right;
|
defaultValue = e.right;
|
||||||
}
|
} else if (e.type === "RestElement") {
|
||||||
else if (e.type === 'RestElement') {
|
|
||||||
// [...a]
|
|
||||||
error(`reactivity destructure does not support rest elements.`, e);
|
error(`reactivity destructure does not support rest elements.`, e);
|
||||||
}
|
} else if (e.type === "ObjectPattern") {
|
||||||
else if (e.type === 'ObjectPattern') {
|
processRefObjectPattern(e, call, isConst, tempVar, [...path, i]);
|
||||||
processRefObjectPattern(e, call, tempVar, [...path, i]);
|
} else if (e.type === "ArrayPattern") {
|
||||||
}
|
processRefArrayPattern(e, call, isConst, tempVar, [...path, i]);
|
||||||
else if (e.type === 'ArrayPattern') {
|
|
||||||
processRefArrayPattern(e, call, tempVar, [...path, i]);
|
|
||||||
}
|
}
|
||||||
if (nameId) {
|
if (nameId) {
|
||||||
registerRefBinding(nameId);
|
registerRefBinding(nameId, isConst);
|
||||||
// inject toRef() after original replaced pattern
|
|
||||||
const source = pathToString(tempVar, path);
|
const source = pathToString(tempVar, path);
|
||||||
const defaultStr = defaultValue ? `, ${snip(defaultValue)}` : ``;
|
const defaultStr = defaultValue ? `, ${snip(defaultValue)}` : ``;
|
||||||
s.appendLeft(call.end + offset, `,\n ${nameId.name} = ${helper('toRef')}(${source}, ${i}${defaultStr})`);
|
s.appendLeft(
|
||||||
|
call.end + offset,
|
||||||
|
`,
|
||||||
|
${nameId.name} = ${helper(
|
||||||
|
"toRef"
|
||||||
|
)}(${source}, ${i}${defaultStr})`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nameId) {
|
if (nameId) {
|
||||||
s.appendLeft(call.end + offset, ';');
|
s.appendLeft(call.end + offset, ";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function pathToString(source, path) {
|
function pathToString(source, path) {
|
||||||
@ -374,8 +346,7 @@ function transformAST(ast, s, offset = 0, knownRefs, knownProps) {
|
|||||||
for (const seg of path) {
|
for (const seg of path) {
|
||||||
if (shared.isArray(seg)) {
|
if (shared.isArray(seg)) {
|
||||||
source = `(${source}${segToString(seg[0])} || ${snip(seg[1])})`;
|
source = `(${source}${segToString(seg[0])} || ${snip(seg[1])})`;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
source += segToString(seg);
|
source += segToString(seg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -383,59 +354,59 @@ function transformAST(ast, s, offset = 0, knownRefs, knownProps) {
|
|||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
function segToString(seg) {
|
function segToString(seg) {
|
||||||
if (typeof seg === 'number') {
|
if (typeof seg === "number") {
|
||||||
return `[${seg}]`;
|
return `[${seg}]`;
|
||||||
}
|
} else if (typeof seg === "string") {
|
||||||
else if (typeof seg === 'string') {
|
|
||||||
return `.${seg}`;
|
return `.${seg}`;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return snip(seg);
|
return snip(seg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function rewriteId(scope, id, parent, parentStack) {
|
function rewriteId(scope, id, parent, parentStack2) {
|
||||||
if (shared.hasOwn(scope, id.name)) {
|
if (shared.hasOwn(scope, id.name)) {
|
||||||
const bindingType = scope[id.name];
|
const binding = scope[id.name];
|
||||||
if (bindingType) {
|
if (binding) {
|
||||||
const isProp = bindingType === 'prop';
|
if (binding.isConst && (parent.type === "AssignmentExpression" && id === parent.left || parent.type === "UpdateExpression")) {
|
||||||
|
error(`Assignment to constant variable.`, id);
|
||||||
|
}
|
||||||
|
const { isProp } = binding;
|
||||||
if (compilerCore.isStaticProperty(parent) && parent.shorthand) {
|
if (compilerCore.isStaticProperty(parent) && parent.shorthand) {
|
||||||
// let binding used in a property shorthand
|
if (!parent.inPattern || compilerCore.isInDestructureAssignment(parent, parentStack2)) {
|
||||||
// skip for destructure patterns
|
|
||||||
if (!parent.inPattern ||
|
|
||||||
compilerCore.isInDestructureAssignment(parent, parentStack)) {
|
|
||||||
if (isProp) {
|
if (isProp) {
|
||||||
if (escapeScope) {
|
if (escapeScope) {
|
||||||
// prop binding in $$()
|
|
||||||
// { prop } -> { prop: __props_prop }
|
|
||||||
registerEscapedPropBinding(id);
|
registerEscapedPropBinding(id);
|
||||||
s.appendLeft(id.end + offset, `: __props_${propsLocalToPublicMap[id.name]}`);
|
s.appendLeft(
|
||||||
|
id.end + offset,
|
||||||
|
`: __props_${propsLocalToPublicMap[id.name]}`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
s.appendLeft(
|
||||||
|
id.end + offset,
|
||||||
|
`: ${shared.genPropsAccessExp(propsLocalToPublicMap[id.name])}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
// { prop } -> { prop: __props.prop }
|
|
||||||
s.appendLeft(id.end + offset, `: ${shared.genPropsAccessExp(propsLocalToPublicMap[id.name])}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// { foo } -> { foo: foo.value }
|
|
||||||
s.appendLeft(id.end + offset, `: ${id.name}.value`);
|
s.appendLeft(id.end + offset, `: ${id.name}.value`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (isProp) {
|
if (isProp) {
|
||||||
if (escapeScope) {
|
if (escapeScope) {
|
||||||
// x --> __props_x
|
|
||||||
registerEscapedPropBinding(id);
|
registerEscapedPropBinding(id);
|
||||||
s.overwrite(id.start + offset, id.end + offset, `__props_${propsLocalToPublicMap[id.name]}`);
|
s.overwrite(
|
||||||
|
id.start + offset,
|
||||||
|
id.end + offset,
|
||||||
|
`__props_${propsLocalToPublicMap[id.name]}`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
s.overwrite(
|
||||||
|
id.start + offset,
|
||||||
|
id.end + offset,
|
||||||
|
shared.genPropsAccessExp(propsLocalToPublicMap[id.name])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
// x --> __props.x
|
s.appendLeft(id.end + offset, ".value");
|
||||||
s.overwrite(id.start + offset, id.end + offset, shared.genPropsAccessExp(propsLocalToPublicMap[id.name]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// x --> x.value
|
|
||||||
s.appendLeft(id.end + offset, '.value');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -448,52 +419,49 @@ function transformAST(ast, s, offset = 0, knownRefs, knownProps) {
|
|||||||
if (!propBindingRefs.hasOwnProperty(id.name)) {
|
if (!propBindingRefs.hasOwnProperty(id.name)) {
|
||||||
propBindingRefs[id.name] = true;
|
propBindingRefs[id.name] = true;
|
||||||
const publicKey = propsLocalToPublicMap[id.name];
|
const publicKey = propsLocalToPublicMap[id.name];
|
||||||
s.prependRight(offset, `const __props_${publicKey} = ${helper(`toRef`)}(__props, '${publicKey}');\n`);
|
s.prependRight(
|
||||||
|
offset,
|
||||||
|
`const __props_${publicKey} = ${helper(
|
||||||
|
`toRef`
|
||||||
|
)}(__props, '${publicKey}');
|
||||||
|
`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check root scope first
|
|
||||||
walkScope(ast, true);
|
walkScope(ast, true);
|
||||||
estreeWalker.walk(ast, {
|
estreeWalker.walk(ast, {
|
||||||
enter(node, parent) {
|
enter(node, parent) {
|
||||||
parent && parentStack.push(parent);
|
parent && parentStack.push(parent);
|
||||||
// function scopes
|
|
||||||
if (compilerCore.isFunctionType(node)) {
|
if (compilerCore.isFunctionType(node)) {
|
||||||
scopeStack.push((currentScope = {}));
|
scopeStack.push(currentScope = {});
|
||||||
compilerCore.walkFunctionParams(node, registerBinding);
|
compilerCore.walkFunctionParams(node, registerBinding);
|
||||||
if (node.body.type === 'BlockStatement') {
|
if (node.body.type === "BlockStatement") {
|
||||||
walkScope(node.body);
|
walkScope(node.body);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// catch param
|
if (node.type === "CatchClause") {
|
||||||
if (node.type === 'CatchClause') {
|
scopeStack.push(currentScope = {});
|
||||||
scopeStack.push((currentScope = {}));
|
if (node.param && node.param.type === "Identifier") {
|
||||||
if (node.param && node.param.type === 'Identifier') {
|
|
||||||
registerBinding(node.param);
|
registerBinding(node.param);
|
||||||
}
|
}
|
||||||
walkScope(node.body);
|
walkScope(node.body);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// non-function block scopes
|
if (node.type === "BlockStatement" && !compilerCore.isFunctionType(parent)) {
|
||||||
if (node.type === 'BlockStatement' && !compilerCore.isFunctionType(parent)) {
|
scopeStack.push(currentScope = {});
|
||||||
scopeStack.push((currentScope = {}));
|
|
||||||
walkScope(node);
|
walkScope(node);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// skip type nodes
|
if (parent && parent.type.startsWith("TS") && parent.type !== "TSAsExpression" && parent.type !== "TSNonNullExpression" && parent.type !== "TSTypeAssertion") {
|
||||||
if (parent &&
|
|
||||||
parent.type.startsWith('TS') &&
|
|
||||||
parent.type !== 'TSAsExpression' &&
|
|
||||||
parent.type !== 'TSNonNullExpression' &&
|
|
||||||
parent.type !== 'TSTypeAssertion') {
|
|
||||||
return this.skip();
|
return this.skip();
|
||||||
}
|
}
|
||||||
if (node.type === 'Identifier' &&
|
if (node.type === "Identifier") {
|
||||||
|
const binding = rootScope[node.name];
|
||||||
|
if (
|
||||||
// if inside $$(), skip unless this is a destructured prop binding
|
// if inside $$(), skip unless this is a destructured prop binding
|
||||||
!(escapeScope && rootScope[node.name] !== 'prop') &&
|
!(escapeScope && (!binding || !binding.isProp)) && compilerCore.isReferencedIdentifier(node, parent, parentStack) && !excludedIds.has(node)
|
||||||
compilerCore.isReferencedIdentifier(node, parent, parentStack) &&
|
) {
|
||||||
!excludedIds.has(node)) {
|
|
||||||
// walk up the scope chain to check if id should be appended .value
|
|
||||||
let i = scopeStack.length;
|
let i = scopeStack.length;
|
||||||
while (i--) {
|
while (i--) {
|
||||||
if (rewriteId(scopeStack[i], node, parent, parentStack)) {
|
if (rewriteId(scopeStack[i], node, parent, parentStack)) {
|
||||||
@ -501,68 +469,75 @@ function transformAST(ast, s, offset = 0, knownRefs, knownProps) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node.type === 'CallExpression' && node.callee.type === 'Identifier') {
|
}
|
||||||
|
if (node.type === "CallExpression" && node.callee.type === "Identifier") {
|
||||||
const callee = node.callee.name;
|
const callee = node.callee.name;
|
||||||
const refCall = isRefCreationCall(callee);
|
const refCall = isRefCreationCall(callee);
|
||||||
if (refCall && (!parent || parent.type !== 'VariableDeclarator')) {
|
if (refCall && (!parent || parent.type !== "VariableDeclarator")) {
|
||||||
return error(`${refCall} can only be used as the initializer of ` +
|
return error(
|
||||||
`a variable declaration.`, node);
|
`${refCall} can only be used as the initializer of a variable declaration.`,
|
||||||
|
node
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (escapeSymbol &&
|
if (escapeSymbol && currentScope[escapeSymbol] === void 0 && callee === escapeSymbol) {
|
||||||
currentScope[escapeSymbol] === undefined &&
|
|
||||||
callee === escapeSymbol) {
|
|
||||||
s.remove(node.callee.start + offset, node.callee.end + offset);
|
|
||||||
escapeScope = node;
|
escapeScope = node;
|
||||||
|
s.remove(node.callee.start + offset, node.callee.end + offset);
|
||||||
|
if ((parent == null ? void 0 : parent.type) === "ExpressionStatement") {
|
||||||
|
let i = (node.leadingComments ? node.leadingComments[0].start : node.start) + offset;
|
||||||
|
while (i--) {
|
||||||
|
const char = s.original.charAt(i);
|
||||||
|
if (char === "\n") {
|
||||||
|
s.prependRight(node.start + offset, ";");
|
||||||
|
break;
|
||||||
|
} else if (!/\s/.test(char)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// TODO remove when out of experimental
|
|
||||||
if (callee === '$raw') {
|
|
||||||
error(`$raw() has been replaced by $$(). ` +
|
|
||||||
`See ${RFC_LINK} for latest updates.`, node);
|
|
||||||
}
|
}
|
||||||
if (callee === '$fromRef') {
|
|
||||||
error(`$fromRef() has been replaced by $(). ` +
|
|
||||||
`See ${RFC_LINK} for latest updates.`, node);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
leave(node, parent) {
|
leave(node, parent) {
|
||||||
parent && parentStack.pop();
|
parent && parentStack.pop();
|
||||||
if ((node.type === 'BlockStatement' && !compilerCore.isFunctionType(parent)) ||
|
if (node.type === "BlockStatement" && !compilerCore.isFunctionType(parent) || compilerCore.isFunctionType(node)) {
|
||||||
compilerCore.isFunctionType(node)) {
|
|
||||||
scopeStack.pop();
|
scopeStack.pop();
|
||||||
currentScope = scopeStack[scopeStack.length - 1] || null;
|
currentScope = scopeStack[scopeStack.length - 1] || null;
|
||||||
}
|
}
|
||||||
if (node === escapeScope) {
|
if (node === escapeScope) {
|
||||||
escapeScope = undefined;
|
escapeScope = void 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
rootRefs: Object.keys(rootScope).filter(key => rootScope[key] === true),
|
rootRefs: Object.keys(rootScope).filter((key) => {
|
||||||
|
const binding = rootScope[key];
|
||||||
|
return binding && !binding.isProp;
|
||||||
|
}),
|
||||||
importedHelpers: [...importedHelpers]
|
importedHelpers: [...importedHelpers]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const RFC_LINK = `https://github.com/vuejs/rfcs/discussions/369`;
|
|
||||||
const hasWarned = {};
|
const hasWarned = {};
|
||||||
function warnExperimental() {
|
function warnExperimental() {
|
||||||
// eslint-disable-next-line
|
if (typeof window !== "undefined") {
|
||||||
if (typeof window !== 'undefined') {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
warnOnce(`Reactivity transform is an experimental feature.\n` +
|
warnOnce(
|
||||||
`Experimental features may change behavior between patch versions.\n` +
|
`Reactivity Transform was an experimental feature and has now been deprecated. It will be removed from Vue core in 3.4. If you intend to continue using it, switch to https://vue-macros.sxzz.moe/features/reactivity-transform.html.
|
||||||
`It is recommended to pin your vue dependencies to exact versions to avoid breakage.\n` +
|
See reason for deprecation here: https://github.com/vuejs/rfcs/discussions/369#discussioncomment-5059028`
|
||||||
`You can follow the proposal's status at ${RFC_LINK}.`);
|
);
|
||||||
}
|
}
|
||||||
function warnOnce(msg) {
|
function warnOnce(msg) {
|
||||||
const isNodeProd = typeof process !== 'undefined' && process.env.NODE_ENV === 'production';
|
const isNodeProd = typeof process !== "undefined" && process.env.NODE_ENV === "production";
|
||||||
if (!isNodeProd && !false && !hasWarned[msg]) {
|
if (!isNodeProd && true && !hasWarned[msg]) {
|
||||||
hasWarned[msg] = true;
|
hasWarned[msg] = true;
|
||||||
warn(msg);
|
warn(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function warn(msg) {
|
function warn(msg) {
|
||||||
console.warn(`\x1b[1m\x1b[33m[@vue/reactivity-transform]\x1b[0m\x1b[33m ${msg}\x1b[0m\n`);
|
console.warn(
|
||||||
|
`\x1B[1m\x1B[33m[@vue/reactivity-transform]\x1B[0m\x1B[33m ${msg}\x1B[0m
|
||||||
|
`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.shouldTransform = shouldTransform;
|
exports.shouldTransform = shouldTransform;
|
||||||
|
@ -1,43 +1,34 @@
|
|||||||
import { ImportDefaultSpecifier } from '@babel/types';
|
import { ImportSpecifier, ImportDefaultSpecifier, ImportNamespaceSpecifier, Program } from '@babel/types';
|
||||||
import { ImportNamespaceSpecifier } from '@babel/types';
|
import MagicString, { SourceMap } from 'magic-string';
|
||||||
import { ImportSpecifier } from '@babel/types';
|
|
||||||
import MagicString from 'magic-string';
|
|
||||||
import { ParserPlugin } from '@babel/parser';
|
import { ParserPlugin } from '@babel/parser';
|
||||||
import { Program } from '@babel/types';
|
|
||||||
import { SourceMap } from 'magic-string';
|
|
||||||
|
|
||||||
export declare interface ImportBinding {
|
export declare function shouldTransform(src: string): boolean;
|
||||||
local: string;
|
export interface RefTransformOptions {
|
||||||
imported: string;
|
|
||||||
source: string;
|
|
||||||
specifier: ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare interface RefTransformOptions {
|
|
||||||
filename?: string;
|
filename?: string;
|
||||||
sourceMap?: boolean;
|
sourceMap?: boolean;
|
||||||
parserPlugins?: ParserPlugin[];
|
parserPlugins?: ParserPlugin[];
|
||||||
importHelpersFrom?: string;
|
importHelpersFrom?: string;
|
||||||
}
|
}
|
||||||
|
export interface RefTransformResults {
|
||||||
export declare interface RefTransformResults {
|
|
||||||
code: string;
|
code: string;
|
||||||
map: SourceMap | null;
|
map: SourceMap | null;
|
||||||
rootRefs: string[];
|
rootRefs: string[];
|
||||||
importedHelpers: string[];
|
importedHelpers: string[];
|
||||||
}
|
}
|
||||||
|
export interface ImportBinding {
|
||||||
export declare function shouldTransform(src: string): boolean;
|
local: string;
|
||||||
|
imported: string;
|
||||||
|
source: string;
|
||||||
|
specifier: ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier;
|
||||||
|
}
|
||||||
export declare function transform(src: string, { filename, sourceMap, parserPlugins, importHelpersFrom }?: RefTransformOptions): RefTransformResults;
|
export declare function transform(src: string, { filename, sourceMap, parserPlugins, importHelpersFrom }?: RefTransformOptions): RefTransformResults;
|
||||||
|
|
||||||
export declare function transformAST(ast: Program, s: MagicString, offset?: number, knownRefs?: string[], knownProps?: Record<string, // public prop key
|
export declare function transformAST(ast: Program, s: MagicString, offset?: number, knownRefs?: string[], knownProps?: Record<string, // public prop key
|
||||||
{
|
{
|
||||||
local: string;
|
local: string;
|
||||||
default?: any;
|
default?: any;
|
||||||
|
isConst?: boolean;
|
||||||
}>): {
|
}>): {
|
||||||
rootRefs: string[];
|
rootRefs: string[];
|
||||||
importedHelpers: string[];
|
importedHelpers: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export { }
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vue/reactivity-transform",
|
"name": "@vue/reactivity-transform",
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"description": "@vue/reactivity-transform",
|
"description": "@vue/reactivity-transform",
|
||||||
"main": "dist/reactivity-transform.cjs.js",
|
"main": "dist/reactivity-transform.cjs.js",
|
||||||
"files": [
|
"files": [
|
||||||
@ -28,14 +28,14 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/vuejs/core/tree/dev/packages/reactivity-transform#readme",
|
"homepage": "https://github.com/vuejs/core/tree/dev/packages/reactivity-transform#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/parser": "^7.16.4",
|
"@babel/parser": "^7.20.15",
|
||||||
"@vue/compiler-core": "3.2.45",
|
"@vue/compiler-core": "3.3.4",
|
||||||
"@vue/shared": "3.2.45",
|
"@vue/shared": "3.3.4",
|
||||||
"estree-walker": "^2.0.2",
|
"estree-walker": "^2.0.2",
|
||||||
"magic-string": "^0.25.7"
|
"magic-string": "^0.30.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.16.0",
|
"@babel/core": "^7.21.3",
|
||||||
"@babel/types": "^7.16.0"
|
"@babel/types": "^7.21.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
This package is inlined into Global & Browser ESM builds of user-facing renderers (e.g. `@vue/runtime-dom`), but also published as a package that can be used standalone. The standalone build should not be used alongside a pre-bundled build of a user-facing renderer, as they will have different internal storage for reactivity connections. A user-facing renderer should re-export all APIs from this package.
|
This package is inlined into Global & Browser ESM builds of user-facing renderers (e.g. `@vue/runtime-dom`), but also published as a package that can be used standalone. The standalone build should not be used alongside a pre-bundled build of a user-facing renderer, as they will have different internal storage for reactivity connections. A user-facing renderer should re-export all APIs from this package.
|
||||||
|
|
||||||
For full exposed APIs, see `src/index.ts`. You can also run `yarn build reactivity --types` from repo root, which will generate an API report at `temp/reactivity.api.md`.
|
For full exposed APIs, see `src/index.ts`.
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,22 +1,291 @@
|
|||||||
import { IfAny } from '@vue/shared';
|
import { IfAny } from '@vue/shared';
|
||||||
|
|
||||||
declare type BaseTypes = string | number | boolean;
|
export declare const enum ReactiveFlags {
|
||||||
|
SKIP = "__v_skip",
|
||||||
|
IS_REACTIVE = "__v_isReactive",
|
||||||
|
IS_READONLY = "__v_isReadonly",
|
||||||
|
IS_SHALLOW = "__v_isShallow",
|
||||||
|
RAW = "__v_raw"
|
||||||
|
}
|
||||||
|
export type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>;
|
||||||
|
/**
|
||||||
|
* Returns a reactive proxy of the object.
|
||||||
|
*
|
||||||
|
* The reactive conversion is "deep": it affects all nested properties. A
|
||||||
|
* reactive object also deeply unwraps any properties that are refs while
|
||||||
|
* maintaining reactivity.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* const obj = reactive({ count: 0 })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param target - The source object.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-core.html#reactive}
|
||||||
|
*/
|
||||||
|
export declare function reactive<T extends object>(target: T): UnwrapNestedRefs<T>;
|
||||||
|
declare const ShallowReactiveMarker: unique symbol;
|
||||||
|
export type ShallowReactive<T> = T & {
|
||||||
|
[ShallowReactiveMarker]?: true;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Shallow version of {@link reactive()}.
|
||||||
|
*
|
||||||
|
* Unlike {@link reactive()}, there is no deep conversion: only root-level
|
||||||
|
* properties are reactive for a shallow reactive object. Property values are
|
||||||
|
* stored and exposed as-is - this also means properties with ref values will
|
||||||
|
* not be automatically unwrapped.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* const state = shallowReactive({
|
||||||
|
* foo: 1,
|
||||||
|
* nested: {
|
||||||
|
* bar: 2
|
||||||
|
* }
|
||||||
|
* })
|
||||||
|
*
|
||||||
|
* // mutating state's own properties is reactive
|
||||||
|
* state.foo++
|
||||||
|
*
|
||||||
|
* // ...but does not convert nested objects
|
||||||
|
* isReactive(state.nested) // false
|
||||||
|
*
|
||||||
|
* // NOT reactive
|
||||||
|
* state.nested.bar++
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param target - The source object.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreactive}
|
||||||
|
*/
|
||||||
|
export declare function shallowReactive<T extends object>(target: T): ShallowReactive<T>;
|
||||||
|
type Primitive = string | number | boolean | bigint | symbol | undefined | null;
|
||||||
|
type Builtin = Primitive | Function | Date | Error | RegExp;
|
||||||
|
export type DeepReadonly<T> = T extends Builtin ? T : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends WeakMap<infer K, infer V> ? WeakMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends WeakSet<infer U> ? WeakSet<DeepReadonly<U>> : T extends Promise<infer U> ? Promise<DeepReadonly<U>> : T extends Ref<infer U> ? Readonly<Ref<DeepReadonly<U>>> : T extends {} ? {
|
||||||
|
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
||||||
|
} : Readonly<T>;
|
||||||
|
/**
|
||||||
|
* Takes an object (reactive or plain) or a ref and returns a readonly proxy to
|
||||||
|
* the original.
|
||||||
|
*
|
||||||
|
* A readonly proxy is deep: any nested property accessed will be readonly as
|
||||||
|
* well. It also has the same ref-unwrapping behavior as {@link reactive()},
|
||||||
|
* except the unwrapped values will also be made readonly.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* const original = reactive({ count: 0 })
|
||||||
|
*
|
||||||
|
* const copy = readonly(original)
|
||||||
|
*
|
||||||
|
* watchEffect(() => {
|
||||||
|
* // works for reactivity tracking
|
||||||
|
* console.log(copy.count)
|
||||||
|
* })
|
||||||
|
*
|
||||||
|
* // mutating original will trigger watchers relying on the copy
|
||||||
|
* original.count++
|
||||||
|
*
|
||||||
|
* // mutating the copy will fail and result in a warning
|
||||||
|
* copy.count++ // warning!
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param target - The source object.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-core.html#readonly}
|
||||||
|
*/
|
||||||
|
export declare function readonly<T extends object>(target: T): DeepReadonly<UnwrapNestedRefs<T>>;
|
||||||
|
/**
|
||||||
|
* Shallow version of {@link readonly()}.
|
||||||
|
*
|
||||||
|
* Unlike {@link readonly()}, there is no deep conversion: only root-level
|
||||||
|
* properties are made readonly. Property values are stored and exposed as-is -
|
||||||
|
* this also means properties with ref values will not be automatically
|
||||||
|
* unwrapped.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* const state = shallowReadonly({
|
||||||
|
* foo: 1,
|
||||||
|
* nested: {
|
||||||
|
* bar: 2
|
||||||
|
* }
|
||||||
|
* })
|
||||||
|
*
|
||||||
|
* // mutating state's own properties will fail
|
||||||
|
* state.foo++
|
||||||
|
*
|
||||||
|
* // ...but works on nested objects
|
||||||
|
* isReadonly(state.nested) // false
|
||||||
|
*
|
||||||
|
* // works
|
||||||
|
* state.nested.bar++
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param target - The source object.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowreadonly}
|
||||||
|
*/
|
||||||
|
export declare function shallowReadonly<T extends object>(target: T): Readonly<T>;
|
||||||
|
/**
|
||||||
|
* Checks if an object is a proxy created by {@link reactive()} or
|
||||||
|
* {@link shallowReactive()} (or {@link ref()} in some cases).
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* isReactive(reactive({})) // => true
|
||||||
|
* isReactive(readonly(reactive({}))) // => true
|
||||||
|
* isReactive(ref({}).value) // => true
|
||||||
|
* isReactive(readonly(ref({})).value) // => true
|
||||||
|
* isReactive(ref(true)) // => false
|
||||||
|
* isReactive(shallowRef({}).value) // => false
|
||||||
|
* isReactive(shallowReactive({})) // => true
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param value - The value to check.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreactive}
|
||||||
|
*/
|
||||||
|
export declare function isReactive(value: unknown): boolean;
|
||||||
|
/**
|
||||||
|
* Checks whether the passed value is a readonly object. The properties of a
|
||||||
|
* readonly object can change, but they can't be assigned directly via the
|
||||||
|
* passed object.
|
||||||
|
*
|
||||||
|
* The proxies created by {@link readonly()} and {@link shallowReadonly()} are
|
||||||
|
* both considered readonly, as is a computed ref without a set function.
|
||||||
|
*
|
||||||
|
* @param value - The value to check.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isreadonly}
|
||||||
|
*/
|
||||||
|
export declare function isReadonly(value: unknown): boolean;
|
||||||
|
export declare function isShallow(value: unknown): boolean;
|
||||||
|
/**
|
||||||
|
* Checks if an object is a proxy created by {@link reactive},
|
||||||
|
* {@link readonly}, {@link shallowReactive} or {@link shallowReadonly()}.
|
||||||
|
*
|
||||||
|
* @param value - The value to check.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy}
|
||||||
|
*/
|
||||||
|
export declare function isProxy(value: unknown): boolean;
|
||||||
|
/**
|
||||||
|
* Returns the raw, original object of a Vue-created proxy.
|
||||||
|
*
|
||||||
|
* `toRaw()` can return the original object from proxies created by
|
||||||
|
* {@link reactive()}, {@link readonly()}, {@link shallowReactive()} or
|
||||||
|
* {@link shallowReadonly()}.
|
||||||
|
*
|
||||||
|
* This is an escape hatch that can be used to temporarily read without
|
||||||
|
* incurring proxy access / tracking overhead or write without triggering
|
||||||
|
* changes. It is **not** recommended to hold a persistent reference to the
|
||||||
|
* original object. Use with caution.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* const foo = {}
|
||||||
|
* const reactiveFoo = reactive(foo)
|
||||||
|
*
|
||||||
|
* console.log(toRaw(reactiveFoo) === foo) // true
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param observed - The object for which the "raw" value is requested.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#toraw}
|
||||||
|
*/
|
||||||
|
export declare function toRaw<T>(observed: T): T;
|
||||||
|
export type Raw<T> = T & {
|
||||||
|
[RawSymbol]?: true;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Marks an object so that it will never be converted to a proxy. Returns the
|
||||||
|
* object itself.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* const foo = markRaw({})
|
||||||
|
* console.log(isReactive(reactive(foo))) // false
|
||||||
|
*
|
||||||
|
* // also works when nested inside other reactive objects
|
||||||
|
* const bar = reactive({ foo })
|
||||||
|
* console.log(isReactive(bar.foo)) // false
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* **Warning:** `markRaw()` together with the shallow APIs such as
|
||||||
|
* {@link shallowReactive()} allow you to selectively opt-out of the default
|
||||||
|
* deep reactive/readonly conversion and embed raw, non-proxied objects in your
|
||||||
|
* state graph.
|
||||||
|
*
|
||||||
|
* @param value - The object to be marked as "raw".
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#markraw}
|
||||||
|
*/
|
||||||
|
export declare function markRaw<T extends object>(value: T): Raw<T>;
|
||||||
|
|
||||||
declare type Builtin = Primitive | Function | Date | Error | RegExp;
|
type CollectionTypes = IterableCollections | WeakCollections;
|
||||||
|
type IterableCollections = Map<any, any> | Set<any>;
|
||||||
|
type WeakCollections = WeakMap<any, any> | WeakSet<any>;
|
||||||
|
|
||||||
declare type CollectionTypes = IterableCollections | WeakCollections;
|
export declare const enum TrackOpTypes {
|
||||||
|
GET = "get",
|
||||||
|
HAS = "has",
|
||||||
|
ITERATE = "iterate"
|
||||||
|
}
|
||||||
|
export declare const enum TriggerOpTypes {
|
||||||
|
SET = "set",
|
||||||
|
ADD = "add",
|
||||||
|
DELETE = "delete",
|
||||||
|
CLEAR = "clear"
|
||||||
|
}
|
||||||
|
|
||||||
export declare function computed<T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions): ComputedRef<T>;
|
export declare class EffectScope {
|
||||||
|
detached: boolean;
|
||||||
|
/* removed internal: _active */
|
||||||
|
/* removed internal: effects */
|
||||||
|
/* removed internal: cleanups */
|
||||||
|
/* removed internal: parent */
|
||||||
|
/* removed internal: scopes */
|
||||||
|
/* removed internal: index */
|
||||||
|
constructor(detached?: boolean);
|
||||||
|
get active(): boolean;
|
||||||
|
run<T>(fn: () => T): T | undefined;
|
||||||
|
/* removed internal: on */
|
||||||
|
/* removed internal: off */
|
||||||
|
stop(fromParent?: boolean): void;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Creates an effect scope object which can capture the reactive effects (i.e.
|
||||||
|
* computed and watchers) created within it so that these effects can be
|
||||||
|
* disposed together. For detailed use cases of this API, please consult its
|
||||||
|
* corresponding {@link https://github.com/vuejs/rfcs/blob/master/active-rfcs/0041-reactivity-effect-scope.md | RFC}.
|
||||||
|
*
|
||||||
|
* @param detached - Can be used to create a "detached" effect scope.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#effectscope}
|
||||||
|
*/
|
||||||
|
export declare function effectScope(detached?: boolean): EffectScope;
|
||||||
|
/**
|
||||||
|
* Returns the current active effect scope if there is one.
|
||||||
|
*
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#getcurrentscope}
|
||||||
|
*/
|
||||||
|
export declare function getCurrentScope(): EffectScope | undefined;
|
||||||
|
/**
|
||||||
|
* Registers a dispose callback on the current active effect scope. The
|
||||||
|
* callback will be invoked when the associated effect scope is stopped.
|
||||||
|
*
|
||||||
|
* @param fn - The callback function to attach to the scope's cleanup.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#onscopedispose}
|
||||||
|
*/
|
||||||
|
export declare function onScopeDispose(fn: () => void): void;
|
||||||
|
|
||||||
export declare function computed<T>(options: WritableComputedOptions<T>, debugOptions?: DebuggerOptions): WritableComputedRef<T>;
|
declare const ComputedRefSymbol: unique symbol;
|
||||||
|
export interface ComputedRef<T = any> extends WritableComputedRef<T> {
|
||||||
export declare type ComputedGetter<T> = (...args: any[]) => T;
|
|
||||||
|
|
||||||
export declare interface ComputedRef<T = any> extends WritableComputedRef<T> {
|
|
||||||
readonly value: T;
|
readonly value: T;
|
||||||
[ComputedRefSymbol]: true;
|
[ComputedRefSymbol]: true;
|
||||||
}
|
}
|
||||||
|
export interface WritableComputedRef<T> extends Ref<T> {
|
||||||
|
readonly effect: ReactiveEffect<T>;
|
||||||
|
}
|
||||||
|
export type ComputedGetter<T> = (...args: any[]) => T;
|
||||||
|
export type ComputedSetter<T> = (v: T) => void;
|
||||||
|
export interface WritableComputedOptions<T> {
|
||||||
|
get: ComputedGetter<T>;
|
||||||
|
set: ComputedSetter<T>;
|
||||||
|
}
|
||||||
declare class ComputedRefImpl<T> {
|
declare class ComputedRefImpl<T> {
|
||||||
private readonly _setter;
|
private readonly _setter;
|
||||||
dep?: Dep;
|
dep?: Dep;
|
||||||
@ -30,23 +299,47 @@ declare class ComputedRefImpl<T> {
|
|||||||
get value(): T;
|
get value(): T;
|
||||||
set value(newValue: T);
|
set value(newValue: T);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Takes a getter function and returns a readonly reactive ref object for the
|
||||||
|
* returned value from the getter. It can also take an object with get and set
|
||||||
|
* functions to create a writable ref object.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* // Creating a readonly computed ref:
|
||||||
|
* const count = ref(1)
|
||||||
|
* const plusOne = computed(() => count.value + 1)
|
||||||
|
*
|
||||||
|
* console.log(plusOne.value) // 2
|
||||||
|
* plusOne.value++ // error
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* // Creating a writable computed ref:
|
||||||
|
* const count = ref(1)
|
||||||
|
* const plusOne = computed({
|
||||||
|
* get: () => count.value + 1,
|
||||||
|
* set: (val) => {
|
||||||
|
* count.value = val - 1
|
||||||
|
* }
|
||||||
|
* })
|
||||||
|
*
|
||||||
|
* plusOne.value = 1
|
||||||
|
* console.log(count.value) // 0
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param getter - Function that produces the next value.
|
||||||
|
* @param debugOptions - For debugging. See {@link https://vuejs.org/guide/extras/reactivity-in-depth.html#computed-debugging}.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-core.html#computed}
|
||||||
|
*/
|
||||||
|
export declare function computed<T>(getter: ComputedGetter<T>, debugOptions?: DebuggerOptions): ComputedRef<T>;
|
||||||
|
export declare function computed<T>(options: WritableComputedOptions<T>, debugOptions?: DebuggerOptions): WritableComputedRef<T>;
|
||||||
|
|
||||||
declare const ComputedRefSymbol: unique symbol;
|
export type EffectScheduler = (...args: any[]) => any;
|
||||||
|
export type DebuggerEvent = {
|
||||||
export declare type ComputedSetter<T> = (v: T) => void;
|
|
||||||
|
|
||||||
export declare function customRef<T>(factory: CustomRefFactory<T>): Ref<T>;
|
|
||||||
|
|
||||||
export declare type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
|
|
||||||
get: () => T;
|
|
||||||
set: (value: T) => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
export declare type DebuggerEvent = {
|
|
||||||
effect: ReactiveEffect;
|
effect: ReactiveEffect;
|
||||||
} & DebuggerEventExtraInfo;
|
} & DebuggerEventExtraInfo;
|
||||||
|
export type DebuggerEventExtraInfo = {
|
||||||
export declare type DebuggerEventExtraInfo = {
|
|
||||||
target: object;
|
target: object;
|
||||||
type: TrackOpTypes | TriggerOpTypes;
|
type: TrackOpTypes | TriggerOpTypes;
|
||||||
key: any;
|
key: any;
|
||||||
@ -54,108 +347,16 @@ export declare type DebuggerEventExtraInfo = {
|
|||||||
oldValue?: any;
|
oldValue?: any;
|
||||||
oldTarget?: Map<any, any> | Set<any>;
|
oldTarget?: Map<any, any> | Set<any>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export declare interface DebuggerOptions {
|
|
||||||
onTrack?: (event: DebuggerEvent) => void;
|
|
||||||
onTrigger?: (event: DebuggerEvent) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare type DeepReadonly<T> = T extends Builtin ? T : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends WeakMap<infer K, infer V> ? WeakMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends WeakSet<infer U> ? WeakSet<DeepReadonly<U>> : T extends Promise<infer U> ? Promise<DeepReadonly<U>> : T extends Ref<infer U> ? Readonly<Ref<DeepReadonly<U>>> : T extends {} ? {
|
|
||||||
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
||||||
} : Readonly<T>;
|
|
||||||
|
|
||||||
export declare function deferredComputed<T>(getter: () => T): ComputedRef<T>;
|
|
||||||
|
|
||||||
declare type Dep = Set<ReactiveEffect> & TrackedMarkers;
|
|
||||||
|
|
||||||
export declare function effect<T = any>(fn: () => T, options?: ReactiveEffectOptions): ReactiveEffectRunner;
|
|
||||||
|
|
||||||
export declare type EffectScheduler = (...args: any[]) => any;
|
|
||||||
|
|
||||||
export declare class EffectScope {
|
|
||||||
detached: boolean;
|
|
||||||
/* Excluded from this release type: active */
|
|
||||||
/* Excluded from this release type: effects */
|
|
||||||
/* Excluded from this release type: cleanups */
|
|
||||||
/* Excluded from this release type: parent */
|
|
||||||
/* Excluded from this release type: scopes */
|
|
||||||
/* Excluded from this release type: index */
|
|
||||||
constructor(detached?: boolean);
|
|
||||||
run<T>(fn: () => T): T | undefined;
|
|
||||||
/* Excluded from this release type: on */
|
|
||||||
/* Excluded from this release type: off */
|
|
||||||
stop(fromParent?: boolean): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare function effectScope(detached?: boolean): EffectScope;
|
|
||||||
|
|
||||||
export declare function enableTracking(): void;
|
|
||||||
|
|
||||||
export declare function getCurrentScope(): EffectScope | undefined;
|
|
||||||
|
|
||||||
export declare function isProxy(value: unknown): boolean;
|
|
||||||
|
|
||||||
export declare function isReactive(value: unknown): boolean;
|
|
||||||
|
|
||||||
export declare function isReadonly(value: unknown): boolean;
|
|
||||||
|
|
||||||
export declare function isRef<T>(r: Ref<T> | unknown): r is Ref<T>;
|
|
||||||
|
|
||||||
export declare function isShallow(value: unknown): boolean;
|
|
||||||
|
|
||||||
declare type IterableCollections = Map<any, any> | Set<any>;
|
|
||||||
|
|
||||||
export declare const ITERATE_KEY: unique symbol;
|
export declare const ITERATE_KEY: unique symbol;
|
||||||
|
|
||||||
export declare function markRaw<T extends object>(value: T): Raw<T>;
|
|
||||||
|
|
||||||
export declare function onScopeDispose(fn: () => void): void;
|
|
||||||
|
|
||||||
export declare function pauseTracking(): void;
|
|
||||||
|
|
||||||
declare type Primitive = string | number | boolean | bigint | symbol | undefined | null;
|
|
||||||
|
|
||||||
export declare function proxyRefs<T extends object>(objectWithRefs: T): ShallowUnwrapRef<T>;
|
|
||||||
|
|
||||||
export declare type Raw<T> = T & {
|
|
||||||
[RawSymbol]?: true;
|
|
||||||
};
|
|
||||||
|
|
||||||
declare const RawSymbol: unique symbol;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a reactive copy of the original object.
|
|
||||||
*
|
|
||||||
* The reactive conversion is "deep"—it affects all nested properties. In the
|
|
||||||
* ES2015 Proxy based implementation, the returned proxy is **not** equal to the
|
|
||||||
* original object. It is recommended to work exclusively with the reactive
|
|
||||||
* proxy and avoid relying on the original object.
|
|
||||||
*
|
|
||||||
* A reactive object also automatically unwraps refs contained in it, so you
|
|
||||||
* don't need to use `.value` when accessing and mutating their value:
|
|
||||||
*
|
|
||||||
* ```js
|
|
||||||
* const count = ref(0)
|
|
||||||
* const obj = reactive({
|
|
||||||
* count
|
|
||||||
* })
|
|
||||||
*
|
|
||||||
* obj.count++
|
|
||||||
* obj.count // -> 1
|
|
||||||
* count.value // -> 1
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
export declare function reactive<T extends object>(target: T): UnwrapNestedRefs<T>;
|
|
||||||
|
|
||||||
export declare class ReactiveEffect<T = any> {
|
export declare class ReactiveEffect<T = any> {
|
||||||
fn: () => T;
|
fn: () => T;
|
||||||
scheduler: EffectScheduler | null;
|
scheduler: EffectScheduler | null;
|
||||||
active: boolean;
|
active: boolean;
|
||||||
deps: Dep[];
|
deps: Dep[];
|
||||||
parent: ReactiveEffect | undefined;
|
parent: ReactiveEffect | undefined;
|
||||||
/* Excluded from this release type: computed */
|
/* removed internal: computed */
|
||||||
/* Excluded from this release type: allowRecurse */
|
/* removed internal: allowRecurse */
|
||||||
/* Excluded from this release type: deferStop */
|
/* removed internal: deferStop */
|
||||||
onStop?: () => void;
|
onStop?: () => void;
|
||||||
onTrack?: (event: DebuggerEvent) => void;
|
onTrack?: (event: DebuggerEvent) => void;
|
||||||
onTrigger?: (event: DebuggerEvent) => void;
|
onTrigger?: (event: DebuggerEvent) => void;
|
||||||
@ -163,35 +364,91 @@ export declare class ReactiveEffect<T = any> {
|
|||||||
run(): T | undefined;
|
run(): T | undefined;
|
||||||
stop(): void;
|
stop(): void;
|
||||||
}
|
}
|
||||||
|
export interface DebuggerOptions {
|
||||||
export declare interface ReactiveEffectOptions extends DebuggerOptions {
|
onTrack?: (event: DebuggerEvent) => void;
|
||||||
|
onTrigger?: (event: DebuggerEvent) => void;
|
||||||
|
}
|
||||||
|
export interface ReactiveEffectOptions extends DebuggerOptions {
|
||||||
lazy?: boolean;
|
lazy?: boolean;
|
||||||
scheduler?: EffectScheduler;
|
scheduler?: EffectScheduler;
|
||||||
scope?: EffectScope;
|
scope?: EffectScope;
|
||||||
allowRecurse?: boolean;
|
allowRecurse?: boolean;
|
||||||
onStop?: () => void;
|
onStop?: () => void;
|
||||||
}
|
}
|
||||||
|
export interface ReactiveEffectRunner<T = any> {
|
||||||
export declare interface ReactiveEffectRunner<T = any> {
|
|
||||||
(): T;
|
(): T;
|
||||||
effect: ReactiveEffect;
|
effect: ReactiveEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
export declare const enum ReactiveFlags {
|
|
||||||
SKIP = "__v_skip",
|
|
||||||
IS_REACTIVE = "__v_isReactive",
|
|
||||||
IS_READONLY = "__v_isReadonly",
|
|
||||||
IS_SHALLOW = "__v_isShallow",
|
|
||||||
RAW = "__v_raw"
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a readonly copy of the original object. Note the returned copy is not
|
* Registers the given function to track reactive updates.
|
||||||
* made reactive, but `readonly` can be called on an already reactive object.
|
*
|
||||||
|
* The given function will be run once immediately. Every time any reactive
|
||||||
|
* property that's accessed within it gets updated, the function will run again.
|
||||||
|
*
|
||||||
|
* @param fn - The function that will track reactive updates.
|
||||||
|
* @param options - Allows to control the effect's behaviour.
|
||||||
|
* @returns A runner that can be used to control the effect after creation.
|
||||||
*/
|
*/
|
||||||
export declare function readonly<T extends object>(target: T): DeepReadonly<UnwrapNestedRefs<T>>;
|
export declare function effect<T = any>(fn: () => T, options?: ReactiveEffectOptions): ReactiveEffectRunner;
|
||||||
|
/**
|
||||||
|
* Stops the effect associated with the given runner.
|
||||||
|
*
|
||||||
|
* @param runner - Association with the effect to stop tracking.
|
||||||
|
*/
|
||||||
|
export declare function stop(runner: ReactiveEffectRunner): void;
|
||||||
|
/**
|
||||||
|
* Temporarily pauses tracking.
|
||||||
|
*/
|
||||||
|
export declare function pauseTracking(): void;
|
||||||
|
/**
|
||||||
|
* Re-enables effect tracking (if it was paused).
|
||||||
|
*/
|
||||||
|
export declare function enableTracking(): void;
|
||||||
|
/**
|
||||||
|
* Resets the previous global effect tracking state.
|
||||||
|
*/
|
||||||
|
export declare function resetTracking(): void;
|
||||||
|
/**
|
||||||
|
* Tracks access to a reactive property.
|
||||||
|
*
|
||||||
|
* This will check which effect is running at the moment and record it as dep
|
||||||
|
* which records all effects that depend on the reactive property.
|
||||||
|
*
|
||||||
|
* @param target - Object holding the reactive property.
|
||||||
|
* @param type - Defines the type of access to the reactive property.
|
||||||
|
* @param key - Identifier of the reactive property to track.
|
||||||
|
*/
|
||||||
|
export declare function track(target: object, type: TrackOpTypes, key: unknown): void;
|
||||||
|
/**
|
||||||
|
* Finds all deps associated with the target (or a specific property) and
|
||||||
|
* triggers the effects stored within.
|
||||||
|
*
|
||||||
|
* @param target - The reactive object.
|
||||||
|
* @param type - Defines the type of the operation that needs to trigger effects.
|
||||||
|
* @param key - Can be used to target a specific reactive property in the target object.
|
||||||
|
*/
|
||||||
|
export declare function trigger(target: object, type: TriggerOpTypes, key?: unknown, newValue?: unknown, oldValue?: unknown, oldTarget?: Map<unknown, unknown> | Set<unknown>): void;
|
||||||
|
|
||||||
export declare interface Ref<T = any> {
|
type Dep = Set<ReactiveEffect> & TrackedMarkers;
|
||||||
|
/**
|
||||||
|
* wasTracked and newTracked maintain the status for several levels of effect
|
||||||
|
* tracking recursion. One bit per level is used to define whether the dependency
|
||||||
|
* was/is tracked.
|
||||||
|
*/
|
||||||
|
type TrackedMarkers = {
|
||||||
|
/**
|
||||||
|
* wasTracked
|
||||||
|
*/
|
||||||
|
w: number;
|
||||||
|
/**
|
||||||
|
* newTracked
|
||||||
|
*/
|
||||||
|
n: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
declare const RefSymbol: unique symbol;
|
||||||
|
declare const RawSymbol: unique symbol;
|
||||||
|
export interface Ref<T = any> {
|
||||||
value: T;
|
value: T;
|
||||||
/**
|
/**
|
||||||
* Type differentiator only.
|
* Type differentiator only.
|
||||||
@ -200,15 +457,192 @@ export declare interface Ref<T = any> {
|
|||||||
*/
|
*/
|
||||||
[RefSymbol]: true;
|
[RefSymbol]: true;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
export declare function ref<T extends object>(value: T): [T] extends [Ref] ? T : Ref<UnwrapRef<T>>;
|
* Checks if a value is a ref object.
|
||||||
|
*
|
||||||
|
* @param r - The value to inspect.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isref}
|
||||||
|
*/
|
||||||
|
export declare function isRef<T>(r: Ref<T> | unknown): r is Ref<T>;
|
||||||
|
/**
|
||||||
|
* Takes an inner value and returns a reactive and mutable ref object, which
|
||||||
|
* has a single property `.value` that points to the inner value.
|
||||||
|
*
|
||||||
|
* @param value - The object to wrap in the ref.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-core.html#ref}
|
||||||
|
*/
|
||||||
|
export declare function ref<T extends Ref>(value: T): T;
|
||||||
export declare function ref<T>(value: T): Ref<UnwrapRef<T>>;
|
export declare function ref<T>(value: T): Ref<UnwrapRef<T>>;
|
||||||
|
|
||||||
export declare function ref<T = any>(): Ref<T | undefined>;
|
export declare function ref<T = any>(): Ref<T | undefined>;
|
||||||
|
declare const ShallowRefMarker: unique symbol;
|
||||||
declare const RefSymbol: unique symbol;
|
export type ShallowRef<T = any> = Ref<T> & {
|
||||||
|
[ShallowRefMarker]?: true;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Shallow version of {@link ref()}.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* const state = shallowRef({ count: 1 })
|
||||||
|
*
|
||||||
|
* // does NOT trigger change
|
||||||
|
* state.value.count = 2
|
||||||
|
*
|
||||||
|
* // does trigger change
|
||||||
|
* state.value = { count: 2 }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param value - The "inner value" for the shallow ref.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#shallowref}
|
||||||
|
*/
|
||||||
|
export declare function shallowRef<T extends object>(value: T): T extends Ref ? T : ShallowRef<T>;
|
||||||
|
export declare function shallowRef<T>(value: T): ShallowRef<T>;
|
||||||
|
export declare function shallowRef<T = any>(): ShallowRef<T | undefined>;
|
||||||
|
/**
|
||||||
|
* Force trigger effects that depends on a shallow ref. This is typically used
|
||||||
|
* after making deep mutations to the inner value of a shallow ref.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* const shallow = shallowRef({
|
||||||
|
* greet: 'Hello, world'
|
||||||
|
* })
|
||||||
|
*
|
||||||
|
* // Logs "Hello, world" once for the first run-through
|
||||||
|
* watchEffect(() => {
|
||||||
|
* console.log(shallow.value.greet)
|
||||||
|
* })
|
||||||
|
*
|
||||||
|
* // This won't trigger the effect because the ref is shallow
|
||||||
|
* shallow.value.greet = 'Hello, universe'
|
||||||
|
*
|
||||||
|
* // Logs "Hello, universe"
|
||||||
|
* triggerRef(shallow)
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param ref - The ref whose tied effects shall be executed.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#triggerref}
|
||||||
|
*/
|
||||||
|
export declare function triggerRef(ref: Ref): void;
|
||||||
|
export type MaybeRef<T = any> = T | Ref<T>;
|
||||||
|
export type MaybeRefOrGetter<T = any> = MaybeRef<T> | (() => T);
|
||||||
|
/**
|
||||||
|
* Returns the inner value if the argument is a ref, otherwise return the
|
||||||
|
* argument itself. This is a sugar function for
|
||||||
|
* `val = isRef(val) ? val.value : val`.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* function useFoo(x: number | Ref<number>) {
|
||||||
|
* const unwrapped = unref(x)
|
||||||
|
* // unwrapped is guaranteed to be number now
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param ref - Ref or plain value to be converted into the plain value.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#unref}
|
||||||
|
*/
|
||||||
|
export declare function unref<T>(ref: MaybeRef<T>): T;
|
||||||
|
/**
|
||||||
|
* Normalizes values / refs / getters to values.
|
||||||
|
* This is similar to {@link unref()}, except that it also normalizes getters.
|
||||||
|
* If the argument is a getter, it will be invoked and its return value will
|
||||||
|
* be returned.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* toValue(1) // 1
|
||||||
|
* toValue(ref(1)) // 1
|
||||||
|
* toValue(() => 1) // 1
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param source - A getter, an existing ref, or a non-function value.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#tovalue}
|
||||||
|
*/
|
||||||
|
export declare function toValue<T>(source: MaybeRefOrGetter<T>): T;
|
||||||
|
/**
|
||||||
|
* Returns a reactive proxy for the given object.
|
||||||
|
*
|
||||||
|
* If the object already is reactive, it's returned as-is. If not, a new
|
||||||
|
* reactive proxy is created. Direct child properties that are refs are properly
|
||||||
|
* handled, as well.
|
||||||
|
*
|
||||||
|
* @param objectWithRefs - Either an already-reactive object or a simple object
|
||||||
|
* that contains refs.
|
||||||
|
*/
|
||||||
|
export declare function proxyRefs<T extends object>(objectWithRefs: T): ShallowUnwrapRef<T>;
|
||||||
|
export type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
|
||||||
|
get: () => T;
|
||||||
|
set: (value: T) => void;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Creates a customized ref with explicit control over its dependency tracking
|
||||||
|
* and updates triggering.
|
||||||
|
*
|
||||||
|
* @param factory - The function that receives the `track` and `trigger` callbacks.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#customref}
|
||||||
|
*/
|
||||||
|
export declare function customRef<T>(factory: CustomRefFactory<T>): Ref<T>;
|
||||||
|
export type ToRefs<T = any> = {
|
||||||
|
[K in keyof T]: ToRef<T[K]>;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Converts a reactive object to a plain object where each property of the
|
||||||
|
* resulting object is a ref pointing to the corresponding property of the
|
||||||
|
* original object. Each individual ref is created using {@link toRef()}.
|
||||||
|
*
|
||||||
|
* @param object - Reactive object to be made into an object of linked refs.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#torefs}
|
||||||
|
*/
|
||||||
|
export declare function toRefs<T extends object>(object: T): ToRefs<T>;
|
||||||
|
export type ToRef<T> = IfAny<T, Ref<T>, [T] extends [Ref] ? T : Ref<T>>;
|
||||||
|
/**
|
||||||
|
* Used to normalize values / refs / getters into refs.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* // returns existing refs as-is
|
||||||
|
* toRef(existingRef)
|
||||||
|
*
|
||||||
|
* // creates a ref that calls the getter on .value access
|
||||||
|
* toRef(() => props.foo)
|
||||||
|
*
|
||||||
|
* // creates normal refs from non-function values
|
||||||
|
* // equivalent to ref(1)
|
||||||
|
* toRef(1)
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Can also be used to create a ref for a property on a source reactive object.
|
||||||
|
* The created ref is synced with its source property: mutating the source
|
||||||
|
* property will update the ref, and vice-versa.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* const state = reactive({
|
||||||
|
* foo: 1,
|
||||||
|
* bar: 2
|
||||||
|
* })
|
||||||
|
*
|
||||||
|
* const fooRef = toRef(state, 'foo')
|
||||||
|
*
|
||||||
|
* // mutating the ref updates the original
|
||||||
|
* fooRef.value++
|
||||||
|
* console.log(state.foo) // 2
|
||||||
|
*
|
||||||
|
* // mutating the original also updates the ref
|
||||||
|
* state.foo++
|
||||||
|
* console.log(fooRef.value) // 3
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param source - A getter, an existing ref, a non-function value, or a
|
||||||
|
* reactive object to create a property ref from.
|
||||||
|
* @param [key] - (optional) Name of the property in the reactive object.
|
||||||
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#toref}
|
||||||
|
*/
|
||||||
|
export declare function toRef<T>(value: T): T extends () => infer R ? Readonly<Ref<R>> : T extends Ref ? T : Ref<UnwrapRef<T>>;
|
||||||
|
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
|
||||||
|
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<Exclude<T[K], undefined>>;
|
||||||
|
type BaseTypes = string | number | boolean;
|
||||||
/**
|
/**
|
||||||
* This is a special exported interface for other packages to declare
|
* This is a special exported interface for other packages to declare
|
||||||
* additional types that should bail out for ref unwrapping. For example
|
* additional types that should bail out for ref unwrapping. For example
|
||||||
@ -221,112 +655,14 @@ declare const RefSymbol: unique symbol;
|
|||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*
|
|
||||||
* Note that api-extractor somehow refuses to include `declare module`
|
|
||||||
* augmentations in its generated d.ts, so we have to manually append them
|
|
||||||
* to the final generated d.ts in our build process.
|
|
||||||
*/
|
*/
|
||||||
export declare interface RefUnwrapBailTypes {
|
export interface RefUnwrapBailTypes {
|
||||||
}
|
}
|
||||||
|
export type ShallowUnwrapRef<T> = {
|
||||||
export declare function resetTracking(): void;
|
|
||||||
|
|
||||||
export declare type ShallowReactive<T> = T & {
|
|
||||||
[ShallowReactiveMarker]?: true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a shallowly-reactive copy of the original object, where only the root
|
|
||||||
* level properties are reactive. It also does not auto-unwrap refs (even at the
|
|
||||||
* root level).
|
|
||||||
*/
|
|
||||||
export declare function shallowReactive<T extends object>(target: T): ShallowReactive<T>;
|
|
||||||
|
|
||||||
declare const ShallowReactiveMarker: unique symbol;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a reactive-copy of the original object, where only the root level
|
|
||||||
* properties are readonly, and does NOT unwrap refs nor recursively convert
|
|
||||||
* returned properties.
|
|
||||||
* This is used for creating the props proxy object for stateful components.
|
|
||||||
*/
|
|
||||||
export declare function shallowReadonly<T extends object>(target: T): Readonly<T>;
|
|
||||||
|
|
||||||
export declare type ShallowRef<T = any> = Ref<T> & {
|
|
||||||
[ShallowRefMarker]?: true;
|
|
||||||
};
|
|
||||||
|
|
||||||
export declare function shallowRef<T extends object>(value: T): T extends Ref ? T : ShallowRef<T>;
|
|
||||||
|
|
||||||
export declare function shallowRef<T>(value: T): ShallowRef<T>;
|
|
||||||
|
|
||||||
export declare function shallowRef<T = any>(): ShallowRef<T | undefined>;
|
|
||||||
|
|
||||||
declare const ShallowRefMarker: unique symbol;
|
|
||||||
|
|
||||||
export declare type ShallowUnwrapRef<T> = {
|
|
||||||
[K in keyof T]: T[K] extends Ref<infer V> ? V : T[K] extends Ref<infer V> | undefined ? unknown extends V ? undefined : V | undefined : T[K];
|
[K in keyof T]: T[K] extends Ref<infer V> ? V : T[K] extends Ref<infer V> | undefined ? unknown extends V ? undefined : V | undefined : T[K];
|
||||||
};
|
};
|
||||||
|
export type UnwrapRef<T> = T extends ShallowRef<infer V> ? V : T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
|
||||||
declare function stop_2(runner: ReactiveEffectRunner): void;
|
type UnwrapRefSimple<T> = T extends Function | CollectionTypes | BaseTypes | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
|
||||||
export { stop_2 as stop }
|
|
||||||
|
|
||||||
export declare function toRaw<T>(observed: T): T;
|
|
||||||
|
|
||||||
export declare type ToRef<T> = IfAny<T, Ref<T>, [T] extends [Ref] ? T : Ref<T>>;
|
|
||||||
|
|
||||||
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K): ToRef<T[K]>;
|
|
||||||
|
|
||||||
export declare function toRef<T extends object, K extends keyof T>(object: T, key: K, defaultValue: T[K]): ToRef<Exclude<T[K], undefined>>;
|
|
||||||
|
|
||||||
export declare type ToRefs<T = any> = {
|
|
||||||
[K in keyof T]: ToRef<T[K]>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export declare function toRefs<T extends object>(object: T): ToRefs<T>;
|
|
||||||
|
|
||||||
export declare function track(target: object, type: TrackOpTypes, key: unknown): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* wasTracked and newTracked maintain the status for several levels of effect
|
|
||||||
* tracking recursion. One bit per level is used to define whether the dependency
|
|
||||||
* was/is tracked.
|
|
||||||
*/
|
|
||||||
declare type TrackedMarkers = {
|
|
||||||
/**
|
|
||||||
* wasTracked
|
|
||||||
*/
|
|
||||||
w: number;
|
|
||||||
/**
|
|
||||||
* newTracked
|
|
||||||
*/
|
|
||||||
n: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
export declare const enum TrackOpTypes {
|
|
||||||
GET = "get",
|
|
||||||
HAS = "has",
|
|
||||||
ITERATE = "iterate"
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare function trigger(target: object, type: TriggerOpTypes, key?: unknown, newValue?: unknown, oldValue?: unknown, oldTarget?: Map<unknown, unknown> | Set<unknown>): void;
|
|
||||||
|
|
||||||
export declare const enum TriggerOpTypes {
|
|
||||||
SET = "set",
|
|
||||||
ADD = "add",
|
|
||||||
DELETE = "delete",
|
|
||||||
CLEAR = "clear"
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare function triggerRef(ref: Ref): void;
|
|
||||||
|
|
||||||
export declare function unref<T>(ref: T | Ref<T>): T;
|
|
||||||
|
|
||||||
export declare type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>;
|
|
||||||
|
|
||||||
export declare type UnwrapRef<T> = T extends ShallowRef<infer V> ? V : T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
|
|
||||||
|
|
||||||
declare type UnwrapRefSimple<T> = T extends Function | CollectionTypes | BaseTypes | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes] | {
|
|
||||||
[RawSymbol]?: true;
|
[RawSymbol]?: true;
|
||||||
} ? T : T extends ReadonlyArray<any> ? {
|
} ? T : T extends ReadonlyArray<any> ? {
|
||||||
[K in keyof T]: UnwrapRefSimple<T[K]>;
|
[K in keyof T]: UnwrapRefSimple<T[K]>;
|
||||||
@ -336,15 +672,5 @@ declare type UnwrapRefSimple<T> = T extends Function | CollectionTypes | BaseTyp
|
|||||||
[P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]>;
|
[P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]>;
|
||||||
} : T;
|
} : T;
|
||||||
|
|
||||||
declare type WeakCollections = WeakMap<any, any> | WeakSet<any>;
|
export declare function deferredComputed<T>(getter: () => T): ComputedRef<T>;
|
||||||
|
|
||||||
export declare interface WritableComputedOptions<T> {
|
|
||||||
get: ComputedGetter<T>;
|
|
||||||
set: ComputedSetter<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export declare interface WritableComputedRef<T> extends Ref<T> {
|
|
||||||
readonly effect: ReactiveEffect<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export { }
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vue/reactivity",
|
"name": "@vue/reactivity",
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"description": "@vue/reactivity",
|
"description": "@vue/reactivity",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"module": "dist/reactivity.esm-bundler.js",
|
"module": "dist/reactivity.esm-bundler.js",
|
||||||
@ -36,6 +36,6 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme",
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/shared": "3.2.45"
|
"@vue/shared": "3.3.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,18 +2,18 @@
|
|||||||
|
|
||||||
> This package is published only for typing and building custom renderers. It is NOT meant to be used in applications.
|
> This package is published only for typing and building custom renderers. It is NOT meant to be used in applications.
|
||||||
|
|
||||||
For full exposed APIs, see `src/index.ts`. You can also run `yarn build runtime-core --types` from repo root, which will generate an API report at `temp/runtime-core.api.md`.
|
For full exposed APIs, see `src/index.ts`.
|
||||||
|
|
||||||
## Building a Custom Renderer
|
## Building a Custom Renderer
|
||||||
|
|
||||||
``` ts
|
```ts
|
||||||
import { createRenderer } from '@vue/runtime-core'
|
import { createRenderer } from '@vue/runtime-core'
|
||||||
|
|
||||||
const { render, createApp } = createRenderer({
|
const { render, createApp } = createRenderer({
|
||||||
patchProp,
|
patchProp,
|
||||||
insert,
|
insert,
|
||||||
remove,
|
remove,
|
||||||
createElement,
|
createElement
|
||||||
// ...
|
// ...
|
||||||
})
|
})
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vue/runtime-core",
|
"name": "@vue/runtime-core",
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"description": "@vue/runtime-core",
|
"description": "@vue/runtime-core",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"module": "dist/runtime-core.esm-bundler.js",
|
"module": "dist/runtime-core.esm-bundler.js",
|
||||||
@ -32,7 +32,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-core#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/shared": "3.2.45",
|
"@vue/shared": "3.3.4",
|
||||||
"@vue/reactivity": "3.2.45"
|
"@vue/reactivity": "3.3.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vue/runtime-dom",
|
"name": "@vue/runtime-dom",
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"description": "@vue/runtime-dom",
|
"description": "@vue/runtime-dom",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"module": "dist/runtime-dom.esm-bundler.js",
|
"module": "dist/runtime-dom.esm-bundler.js",
|
||||||
@ -35,8 +35,8 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-dom#readme",
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/runtime-dom#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/shared": "3.2.45",
|
"@vue/shared": "3.3.4",
|
||||||
"@vue/runtime-core": "3.2.45",
|
"@vue/runtime-core": "3.3.4",
|
||||||
"csstype": "^2.6.8"
|
"csstype": "^3.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,57 +1,65 @@
|
|||||||
/// <reference types="node" />
|
/// <reference types="node" />
|
||||||
|
import { VNode, ComponentInternalInstance, App, Slots, Component } from 'vue';
|
||||||
|
import { Readable, Writable } from 'stream';
|
||||||
|
import { ComponentPublicInstance, Directive } from '@vue/runtime-core';
|
||||||
|
export { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
|
||||||
|
|
||||||
import { App } from 'vue';
|
type SSRBuffer = SSRBufferItem[] & {
|
||||||
import { Component } from 'vue';
|
hasAsync?: boolean;
|
||||||
import { ComponentInternalInstance } from 'vue';
|
};
|
||||||
import { ComponentPublicInstance } from '@vue/runtime-core';
|
type SSRBufferItem = string | SSRBuffer | Promise<SSRBuffer>;
|
||||||
import { Directive } from '@vue/runtime-core';
|
type PushFn = (item: SSRBufferItem) => void;
|
||||||
import { Readable } from 'stream';
|
type Props = Record<string, unknown>;
|
||||||
import { Slots } from 'vue';
|
export type SSRContext = {
|
||||||
import { includeBooleanAttr as ssrIncludeBooleanAttr } from '@vue/shared';
|
[key: string]: any;
|
||||||
import { VNode } from 'vue';
|
teleports?: Record<string, string>;
|
||||||
import { Writable } from 'stream';
|
/* removed internal: __teleportBuffers */
|
||||||
|
/* removed internal: __watcherHandles */
|
||||||
|
};
|
||||||
|
export declare function renderVNode(push: PushFn, vnode: VNode, parentComponent: ComponentInternalInstance, slotScopeId?: string): void;
|
||||||
|
|
||||||
export declare function pipeToNodeWritable(input: App | VNode, context: SSRContext | undefined, writable: Writable): void;
|
export declare function renderToString(input: App | VNode, context?: SSRContext): Promise<string>;
|
||||||
|
|
||||||
export declare function pipeToWebWritable(input: App | VNode, context: SSRContext | undefined, writable: WritableStream): void;
|
|
||||||
|
|
||||||
declare type Props = Record<string, unknown>;
|
|
||||||
|
|
||||||
declare type PushFn = (item: SSRBufferItem) => void;
|
|
||||||
|
|
||||||
export declare function renderToNodeStream(input: App | VNode, context?: SSRContext): Readable;
|
|
||||||
|
|
||||||
|
export interface SimpleReadable {
|
||||||
|
push(chunk: string | null): void;
|
||||||
|
destroy(err: any): void;
|
||||||
|
}
|
||||||
export declare function renderToSimpleStream<T extends SimpleReadable>(input: App | VNode, context: SSRContext, stream: T): T;
|
export declare function renderToSimpleStream<T extends SimpleReadable>(input: App | VNode, context: SSRContext, stream: T): T;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
export declare function renderToStream(input: App | VNode, context?: SSRContext): Readable;
|
export declare function renderToStream(input: App | VNode, context?: SSRContext): Readable;
|
||||||
|
export declare function renderToNodeStream(input: App | VNode, context?: SSRContext): Readable;
|
||||||
export declare function renderToString(input: App | VNode, context?: SSRContext): Promise<string>;
|
export declare function pipeToNodeWritable(input: App | VNode, context: SSRContext | undefined, writable: Writable): void;
|
||||||
|
|
||||||
export declare function renderToWebStream(input: App | VNode, context?: SSRContext): ReadableStream;
|
export declare function renderToWebStream(input: App | VNode, context?: SSRContext): ReadableStream;
|
||||||
|
export declare function pipeToWebWritable(input: App | VNode, context: SSRContext | undefined, writable: WritableStream): void;
|
||||||
|
|
||||||
export declare interface SimpleReadable {
|
type SSRSlots = Record<string, SSRSlot>;
|
||||||
push(chunk: string | null): void;
|
type SSRSlot = (props: Props, push: PushFn, parentComponent: ComponentInternalInstance | null, scopeId: string | null) => void;
|
||||||
destroy(err: any): void;
|
export declare function ssrRenderSlot(slots: Slots | SSRSlots, slotName: string, slotProps: Props, fallbackRenderFn: (() => void) | null, push: PushFn, parentComponent: ComponentInternalInstance, slotScopeId?: string): void;
|
||||||
}
|
export declare function ssrRenderSlotInner(slots: Slots | SSRSlots, slotName: string, slotProps: Props, fallbackRenderFn: (() => void) | null, push: PushFn, parentComponent: ComponentInternalInstance, slotScopeId?: string, transition?: boolean): void;
|
||||||
|
|
||||||
declare type SSRBuffer = SSRBufferItem[] & {
|
export declare function ssrRenderComponent(comp: Component, props?: Props | null, children?: Slots | SSRSlots | null, parentComponent?: ComponentInternalInstance | null, slotScopeId?: string): SSRBuffer | Promise<SSRBuffer>;
|
||||||
hasAsync?: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
declare type SSRBufferItem = string | SSRBuffer | Promise<SSRBuffer>;
|
export declare function ssrRenderTeleport(parentPush: PushFn, contentRenderFn: (push: PushFn) => void, target: string, disabled: boolean, parentComponent: ComponentInternalInstance): void;
|
||||||
|
|
||||||
export declare type SSRContext = {
|
export declare function ssrRenderAttrs(props: Record<string, unknown>, tag?: string): string;
|
||||||
[key: string]: any;
|
export declare function ssrRenderDynamicAttr(key: string, value: unknown, tag?: string): string;
|
||||||
teleports?: Record<string, string>;
|
export declare function ssrRenderAttr(key: string, value: unknown): string;
|
||||||
/* Excluded from this release type: __teleportBuffers */
|
export declare function ssrRenderClass(raw: unknown): string;
|
||||||
/* Excluded from this release type: __watcherHandles */
|
export declare function ssrRenderStyle(raw: unknown): string;
|
||||||
};
|
|
||||||
|
export declare function ssrInterpolate(value: unknown): string;
|
||||||
|
|
||||||
|
export declare function ssrRenderList(source: unknown, renderItem: (value: unknown, key: string | number, index?: number) => void): void;
|
||||||
|
|
||||||
|
export declare function ssrRenderSuspense(push: PushFn, { default: renderContent }: Record<string, (() => void) | undefined>): Promise<void>;
|
||||||
|
|
||||||
export declare function ssrGetDirectiveProps(instance: ComponentPublicInstance, dir: Directive, value?: any, arg?: string, modifiers?: Record<string, boolean>): Record<string, any>;
|
export declare function ssrGetDirectiveProps(instance: ComponentPublicInstance, dir: Directive, value?: any, arg?: string, modifiers?: Record<string, boolean>): Record<string, any>;
|
||||||
|
|
||||||
|
export declare const ssrLooseEqual: (a: unknown, b: unknown) => boolean;
|
||||||
|
export declare function ssrLooseContain(arr: unknown[], value: unknown): boolean;
|
||||||
|
export declare function ssrRenderDynamicModel(type: unknown, model: unknown, value: unknown): string;
|
||||||
export declare function ssrGetDynamicModelProps(existingProps: any, model: unknown): {
|
export declare function ssrGetDynamicModelProps(existingProps: any, model: unknown): {
|
||||||
checked: boolean;
|
checked: boolean;
|
||||||
value?: undefined;
|
value?: undefined;
|
||||||
@ -60,42 +68,4 @@ export declare function ssrGetDynamicModelProps(existingProps: any, model: unkno
|
|||||||
checked?: undefined;
|
checked?: undefined;
|
||||||
} | null;
|
} | null;
|
||||||
|
|
||||||
export { ssrIncludeBooleanAttr }
|
export { renderVNode as ssrRenderVNode };
|
||||||
|
|
||||||
export declare function ssrInterpolate(value: unknown): string;
|
|
||||||
|
|
||||||
export declare function ssrLooseContain(arr: unknown[], value: unknown): boolean;
|
|
||||||
|
|
||||||
export declare const ssrLooseEqual: (a: unknown, b: unknown) => boolean;
|
|
||||||
|
|
||||||
export declare function ssrRenderAttr(key: string, value: unknown): string;
|
|
||||||
|
|
||||||
export declare function ssrRenderAttrs(props: Record<string, unknown>, tag?: string): string;
|
|
||||||
|
|
||||||
export declare function ssrRenderClass(raw: unknown): string;
|
|
||||||
|
|
||||||
export declare function ssrRenderComponent(comp: Component, props?: Props | null, children?: Slots | SSRSlots | null, parentComponent?: ComponentInternalInstance | null, slotScopeId?: string): SSRBuffer | Promise<SSRBuffer>;
|
|
||||||
|
|
||||||
export declare function ssrRenderDynamicAttr(key: string, value: unknown, tag?: string): string;
|
|
||||||
|
|
||||||
export declare function ssrRenderDynamicModel(type: unknown, model: unknown, value: unknown): string;
|
|
||||||
|
|
||||||
export declare function ssrRenderList(source: unknown, renderItem: (value: unknown, key: string | number, index?: number) => void): void;
|
|
||||||
|
|
||||||
export declare function ssrRenderSlot(slots: Slots | SSRSlots, slotName: string, slotProps: Props, fallbackRenderFn: (() => void) | null, push: PushFn, parentComponent: ComponentInternalInstance, slotScopeId?: string): void;
|
|
||||||
|
|
||||||
export declare function ssrRenderSlotInner(slots: Slots | SSRSlots, slotName: string, slotProps: Props, fallbackRenderFn: (() => void) | null, push: PushFn, parentComponent: ComponentInternalInstance, slotScopeId?: string, transition?: boolean): void;
|
|
||||||
|
|
||||||
export declare function ssrRenderStyle(raw: unknown): string;
|
|
||||||
|
|
||||||
export declare function ssrRenderSuspense(push: PushFn, { default: renderContent }: Record<string, (() => void) | undefined>): Promise<void>;
|
|
||||||
|
|
||||||
export declare function ssrRenderTeleport(parentPush: PushFn, contentRenderFn: (push: PushFn) => void, target: string, disabled: boolean, parentComponent: ComponentInternalInstance): void;
|
|
||||||
|
|
||||||
export declare function ssrRenderVNode(push: PushFn, vnode: VNode, parentComponent: ComponentInternalInstance, slotScopeId?: string): void;
|
|
||||||
|
|
||||||
declare type SSRSlot = (props: Props, push: PushFn, parentComponent: ComponentInternalInstance | null, scopeId: string | null) => void;
|
|
||||||
|
|
||||||
declare type SSRSlots = Record<string, SSRSlot>;
|
|
||||||
|
|
||||||
export { }
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vue/server-renderer",
|
"name": "@vue/server-renderer",
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"description": "@vue/server-renderer",
|
"description": "@vue/server-renderer",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"module": "dist/server-renderer.esm-bundler.js",
|
"module": "dist/server-renderer.esm-bundler.js",
|
||||||
@ -32,10 +32,10 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/vuejs/core/tree/main/packages/server-renderer#readme",
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/server-renderer#readme",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"vue": "3.2.45"
|
"vue": "3.3.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/shared": "3.2.45",
|
"@vue/shared": "3.3.4",
|
||||||
"@vue/compiler-ssr": "3.2.45"
|
"@vue/compiler-ssr": "3.3.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,90 +2,165 @@
|
|||||||
|
|
||||||
Object.defineProperty(exports, '__esModule', { value: true });
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a map and return a function for checking if a key
|
|
||||||
* is in that map.
|
|
||||||
* IMPORTANT: all calls of this function must be prefixed with
|
|
||||||
* \/\*#\_\_PURE\_\_\*\/
|
|
||||||
* So that rollup can tree-shake them if necessary.
|
|
||||||
*/
|
|
||||||
function makeMap(str, expectsLowerCase) {
|
function makeMap(str, expectsLowerCase) {
|
||||||
const map = Object.create(null);
|
const map = /* @__PURE__ */ Object.create(null);
|
||||||
const list = str.split(',');
|
const list = str.split(",");
|
||||||
for (let i = 0; i < list.length; i++) {
|
for (let i = 0; i < list.length; i++) {
|
||||||
map[list[i]] = true;
|
map[list[i]] = true;
|
||||||
}
|
}
|
||||||
return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
|
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
|
||||||
|
}
|
||||||
|
|
||||||
|
const EMPTY_OBJ = Object.freeze({}) ;
|
||||||
|
const EMPTY_ARR = Object.freeze([]) ;
|
||||||
|
const NOOP = () => {
|
||||||
|
};
|
||||||
|
const NO = () => false;
|
||||||
|
const onRE = /^on[^a-z]/;
|
||||||
|
const isOn = (key) => onRE.test(key);
|
||||||
|
const isModelListener = (key) => key.startsWith("onUpdate:");
|
||||||
|
const extend = Object.assign;
|
||||||
|
const remove = (arr, el) => {
|
||||||
|
const i = arr.indexOf(el);
|
||||||
|
if (i > -1) {
|
||||||
|
arr.splice(i, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||||
|
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||||
|
const isArray = Array.isArray;
|
||||||
|
const isMap = (val) => toTypeString(val) === "[object Map]";
|
||||||
|
const isSet = (val) => toTypeString(val) === "[object Set]";
|
||||||
|
const isDate = (val) => toTypeString(val) === "[object Date]";
|
||||||
|
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
||||||
|
const isFunction = (val) => typeof val === "function";
|
||||||
|
const isString = (val) => typeof val === "string";
|
||||||
|
const isSymbol = (val) => typeof val === "symbol";
|
||||||
|
const isObject = (val) => val !== null && typeof val === "object";
|
||||||
|
const isPromise = (val) => {
|
||||||
|
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
||||||
|
};
|
||||||
|
const objectToString = Object.prototype.toString;
|
||||||
|
const toTypeString = (value) => objectToString.call(value);
|
||||||
|
const toRawType = (value) => {
|
||||||
|
return toTypeString(value).slice(8, -1);
|
||||||
|
};
|
||||||
|
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
||||||
|
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
||||||
|
const isReservedProp = /* @__PURE__ */ makeMap(
|
||||||
|
// the leading comma is intentional so empty string "" is also included
|
||||||
|
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
||||||
|
);
|
||||||
|
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
||||||
|
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
||||||
|
);
|
||||||
|
const cacheStringFunction = (fn) => {
|
||||||
|
const cache = /* @__PURE__ */ Object.create(null);
|
||||||
|
return (str) => {
|
||||||
|
const hit = cache[str];
|
||||||
|
return hit || (cache[str] = fn(str));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
const camelizeRE = /-(\w)/g;
|
||||||
|
const camelize = cacheStringFunction((str) => {
|
||||||
|
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
||||||
|
});
|
||||||
|
const hyphenateRE = /\B([A-Z])/g;
|
||||||
|
const hyphenate = cacheStringFunction(
|
||||||
|
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
||||||
|
);
|
||||||
|
const capitalize = cacheStringFunction(
|
||||||
|
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
||||||
|
);
|
||||||
|
const toHandlerKey = cacheStringFunction(
|
||||||
|
(str) => str ? `on${capitalize(str)}` : ``
|
||||||
|
);
|
||||||
|
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
||||||
|
const invokeArrayFns = (fns, arg) => {
|
||||||
|
for (let i = 0; i < fns.length; i++) {
|
||||||
|
fns[i](arg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const def = (obj, key, value) => {
|
||||||
|
Object.defineProperty(obj, key, {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: false,
|
||||||
|
value
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const looseToNumber = (val) => {
|
||||||
|
const n = parseFloat(val);
|
||||||
|
return isNaN(n) ? val : n;
|
||||||
|
};
|
||||||
|
const toNumber = (val) => {
|
||||||
|
const n = isString(val) ? Number(val) : NaN;
|
||||||
|
return isNaN(n) ? val : n;
|
||||||
|
};
|
||||||
|
let _globalThis;
|
||||||
|
const getGlobalThis = () => {
|
||||||
|
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
||||||
|
};
|
||||||
|
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
||||||
|
function genPropsAccessExp(name) {
|
||||||
|
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* dev only flag -> name mapping
|
|
||||||
*/
|
|
||||||
const PatchFlagNames = {
|
const PatchFlagNames = {
|
||||||
[1 /* PatchFlags.TEXT */]: `TEXT`,
|
[1]: `TEXT`,
|
||||||
[2 /* PatchFlags.CLASS */]: `CLASS`,
|
[2]: `CLASS`,
|
||||||
[4 /* PatchFlags.STYLE */]: `STYLE`,
|
[4]: `STYLE`,
|
||||||
[8 /* PatchFlags.PROPS */]: `PROPS`,
|
[8]: `PROPS`,
|
||||||
[16 /* PatchFlags.FULL_PROPS */]: `FULL_PROPS`,
|
[16]: `FULL_PROPS`,
|
||||||
[32 /* PatchFlags.HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
|
[32]: `HYDRATE_EVENTS`,
|
||||||
[64 /* PatchFlags.STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
|
[64]: `STABLE_FRAGMENT`,
|
||||||
[128 /* PatchFlags.KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
|
[128]: `KEYED_FRAGMENT`,
|
||||||
[256 /* PatchFlags.UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
|
[256]: `UNKEYED_FRAGMENT`,
|
||||||
[512 /* PatchFlags.NEED_PATCH */]: `NEED_PATCH`,
|
[512]: `NEED_PATCH`,
|
||||||
[1024 /* PatchFlags.DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
|
[1024]: `DYNAMIC_SLOTS`,
|
||||||
[2048 /* PatchFlags.DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
|
[2048]: `DEV_ROOT_FRAGMENT`,
|
||||||
[-1 /* PatchFlags.HOISTED */]: `HOISTED`,
|
[-1]: `HOISTED`,
|
||||||
[-2 /* PatchFlags.BAIL */]: `BAIL`
|
[-2]: `BAIL`
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Dev only
|
|
||||||
*/
|
|
||||||
const slotFlagsText = {
|
const slotFlagsText = {
|
||||||
[1 /* SlotFlags.STABLE */]: 'STABLE',
|
[1]: "STABLE",
|
||||||
[2 /* SlotFlags.DYNAMIC */]: 'DYNAMIC',
|
[2]: "DYNAMIC",
|
||||||
[3 /* SlotFlags.FORWARDED */]: 'FORWARDED'
|
[3]: "FORWARDED"
|
||||||
};
|
};
|
||||||
|
|
||||||
const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
|
const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
|
||||||
'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
|
const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
|
||||||
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
|
|
||||||
const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
|
|
||||||
|
|
||||||
const range = 2;
|
const range = 2;
|
||||||
function generateCodeFrame(source, start = 0, end = source.length) {
|
function generateCodeFrame(source, start = 0, end = source.length) {
|
||||||
// Split the content into individual lines but capture the newline sequence
|
|
||||||
// that separated each line. This is important because the actual sequence is
|
|
||||||
// needed to properly take into account the full line length for offset
|
|
||||||
// comparison
|
|
||||||
let lines = source.split(/(\r?\n)/);
|
let lines = source.split(/(\r?\n)/);
|
||||||
// Separate the lines and newline sequences into separate arrays for easier referencing
|
|
||||||
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
||||||
lines = lines.filter((_, idx) => idx % 2 === 0);
|
lines = lines.filter((_, idx) => idx % 2 === 0);
|
||||||
let count = 0;
|
let count = 0;
|
||||||
const res = [];
|
const res = [];
|
||||||
for (let i = 0; i < lines.length; i++) {
|
for (let i = 0; i < lines.length; i++) {
|
||||||
count +=
|
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
|
||||||
lines[i].length +
|
|
||||||
((newlineSequences[i] && newlineSequences[i].length) || 0);
|
|
||||||
if (count >= start) {
|
if (count >= start) {
|
||||||
for (let j = i - range; j <= i + range || end > count; j++) {
|
for (let j = i - range; j <= i + range || end > count; j++) {
|
||||||
if (j < 0 || j >= lines.length)
|
if (j < 0 || j >= lines.length)
|
||||||
continue;
|
continue;
|
||||||
const line = j + 1;
|
const line = j + 1;
|
||||||
res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
|
res.push(
|
||||||
|
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
|
||||||
|
);
|
||||||
const lineLength = lines[j].length;
|
const lineLength = lines[j].length;
|
||||||
const newLineSeqLength = (newlineSequences[j] && newlineSequences[j].length) || 0;
|
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
|
||||||
if (j === i) {
|
if (j === i) {
|
||||||
// push underline
|
|
||||||
const pad = start - (count - (lineLength + newLineSeqLength));
|
const pad = start - (count - (lineLength + newLineSeqLength));
|
||||||
const length = Math.max(1, end > count ? lineLength - pad : end - start);
|
const length = Math.max(
|
||||||
res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));
|
1,
|
||||||
}
|
end > count ? lineLength - pad : end - start
|
||||||
else if (j > i) {
|
);
|
||||||
|
res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
|
||||||
|
} else if (j > i) {
|
||||||
if (end > count) {
|
if (end > count) {
|
||||||
const length = Math.max(Math.min(end - count, lineLength), 1);
|
const length = Math.max(Math.min(end - count, lineLength), 1);
|
||||||
res.push(` | ` + '^'.repeat(length));
|
res.push(` | ` + "^".repeat(length));
|
||||||
}
|
}
|
||||||
count += lineLength + newLineSeqLength;
|
count += lineLength + newLineSeqLength;
|
||||||
}
|
}
|
||||||
@ -93,7 +168,7 @@ function generateCodeFrame(source, start = 0, end = source.length) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res.join('\n');
|
return res.join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeStyle(value) {
|
function normalizeStyle(value) {
|
||||||
@ -101,9 +176,7 @@ function normalizeStyle(value) {
|
|||||||
const res = {};
|
const res = {};
|
||||||
for (let i = 0; i < value.length; i++) {
|
for (let i = 0; i < value.length; i++) {
|
||||||
const item = value[i];
|
const item = value[i];
|
||||||
const normalized = isString(item)
|
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
||||||
? parseStringStyle(item)
|
|
||||||
: normalizeStyle(item);
|
|
||||||
if (normalized) {
|
if (normalized) {
|
||||||
for (const key in normalized) {
|
for (const key in normalized) {
|
||||||
res[key] = normalized[key];
|
res[key] = normalized[key];
|
||||||
@ -111,23 +184,18 @@ function normalizeStyle(value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
} else if (isString(value)) {
|
||||||
else if (isString(value)) {
|
|
||||||
return value;
|
return value;
|
||||||
}
|
} else if (isObject(value)) {
|
||||||
else if (isObject(value)) {
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const listDelimiterRE = /;(?![^(]*\))/g;
|
const listDelimiterRE = /;(?![^(]*\))/g;
|
||||||
const propertyDelimiterRE = /:([^]+)/;
|
const propertyDelimiterRE = /:([^]+)/;
|
||||||
const styleCommentRE = /\/\*.*?\*\//gs;
|
const styleCommentRE = /\/\*[^]*?\*\//g;
|
||||||
function parseStringStyle(cssText) {
|
function parseStringStyle(cssText) {
|
||||||
const ret = {};
|
const ret = {};
|
||||||
cssText
|
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
||||||
.replace(styleCommentRE, '')
|
|
||||||
.split(listDelimiterRE)
|
|
||||||
.forEach(item => {
|
|
||||||
if (item) {
|
if (item) {
|
||||||
const tmp = item.split(propertyDelimiterRE);
|
const tmp = item.split(propertyDelimiterRE);
|
||||||
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
||||||
@ -136,37 +204,34 @@ function parseStringStyle(cssText) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
function stringifyStyle(styles) {
|
function stringifyStyle(styles) {
|
||||||
let ret = '';
|
let ret = "";
|
||||||
if (!styles || isString(styles)) {
|
if (!styles || isString(styles)) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
for (const key in styles) {
|
for (const key in styles) {
|
||||||
const value = styles[key];
|
const value = styles[key];
|
||||||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
||||||
if (isString(value) || typeof value === 'number') {
|
if (isString(value) || typeof value === "number") {
|
||||||
// only render valid values
|
|
||||||
ret += `${normalizedKey}:${value};`;
|
ret += `${normalizedKey}:${value};`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
function normalizeClass(value) {
|
function normalizeClass(value) {
|
||||||
let res = '';
|
let res = "";
|
||||||
if (isString(value)) {
|
if (isString(value)) {
|
||||||
res = value;
|
res = value;
|
||||||
}
|
} else if (isArray(value)) {
|
||||||
else if (isArray(value)) {
|
|
||||||
for (let i = 0; i < value.length; i++) {
|
for (let i = 0; i < value.length; i++) {
|
||||||
const normalized = normalizeClass(value[i]);
|
const normalized = normalizeClass(value[i]);
|
||||||
if (normalized) {
|
if (normalized) {
|
||||||
res += normalized + ' ';
|
res += normalized + " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (isObject(value)) {
|
||||||
else if (isObject(value)) {
|
|
||||||
for (const name in value) {
|
for (const name in value) {
|
||||||
if (value[name]) {
|
if (value[name]) {
|
||||||
res += name + ' ';
|
res += name + " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,71 +250,20 @@ function normalizeProps(props) {
|
|||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
// These tag configs are shared between compiler-dom and runtime-dom, so they
|
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
|
||||||
const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
|
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
|
||||||
'header,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
|
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
|
||||||
'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
|
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
|
||||||
'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +
|
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
|
||||||
'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
|
|
||||||
'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
|
|
||||||
'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
|
|
||||||
'option,output,progress,select,textarea,details,dialog,menu,' +
|
|
||||||
'summary,template,blockquote,iframe,tfoot';
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/SVG/Element
|
|
||||||
const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
|
|
||||||
'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
|
|
||||||
'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
|
|
||||||
'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
|
|
||||||
'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
|
|
||||||
'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
|
|
||||||
'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
|
|
||||||
'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
|
|
||||||
'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
|
|
||||||
'text,textPath,title,tspan,unknown,use,view';
|
|
||||||
const VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
|
|
||||||
/**
|
|
||||||
* Compiler only.
|
|
||||||
* Do NOT use in runtime code paths unless behind `true` flag.
|
|
||||||
*/
|
|
||||||
const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
|
|
||||||
/**
|
|
||||||
* Compiler only.
|
|
||||||
* Do NOT use in runtime code paths unless behind `true` flag.
|
|
||||||
*/
|
|
||||||
const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
|
|
||||||
/**
|
|
||||||
* Compiler only.
|
|
||||||
* Do NOT use in runtime code paths unless behind `true` flag.
|
|
||||||
*/
|
|
||||||
const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On the client we only need to offer special cases for boolean attributes that
|
|
||||||
* have different names from their corresponding dom properties:
|
|
||||||
* - itemscope -> N/A
|
|
||||||
* - allowfullscreen -> allowFullscreen
|
|
||||||
* - formnovalidate -> formNoValidate
|
|
||||||
* - ismap -> isMap
|
|
||||||
* - nomodule -> noModule
|
|
||||||
* - novalidate -> noValidate
|
|
||||||
* - readonly -> readOnly
|
|
||||||
*/
|
|
||||||
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
||||||
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
|
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
|
||||||
/**
|
const isBooleanAttr = /* @__PURE__ */ makeMap(
|
||||||
* The full list is needed during SSR to produce the correct initial markup.
|
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
|
||||||
*/
|
);
|
||||||
const isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +
|
|
||||||
`,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +
|
|
||||||
`loop,open,required,reversed,scoped,seamless,` +
|
|
||||||
`checked,muted,multiple,selected`);
|
|
||||||
/**
|
|
||||||
* Boolean attributes should be included if the value is truthy or ''.
|
|
||||||
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
||||||
*/
|
|
||||||
function includeBooleanAttr(value) {
|
function includeBooleanAttr(value) {
|
||||||
return !!value || value === '';
|
return !!value || value === "";
|
||||||
}
|
}
|
||||||
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
||||||
const attrValidationCache = {};
|
const attrValidationCache = {};
|
||||||
@ -261,105 +275,48 @@ function isSSRSafeAttrName(name) {
|
|||||||
if (isUnsafe) {
|
if (isUnsafe) {
|
||||||
console.error(`unsafe attribute name: ${name}`);
|
console.error(`unsafe attribute name: ${name}`);
|
||||||
}
|
}
|
||||||
return (attrValidationCache[name] = !isUnsafe);
|
return attrValidationCache[name] = !isUnsafe;
|
||||||
}
|
}
|
||||||
const propsToAttrMap = {
|
const propsToAttrMap = {
|
||||||
acceptCharset: 'accept-charset',
|
acceptCharset: "accept-charset",
|
||||||
className: 'class',
|
className: "class",
|
||||||
htmlFor: 'for',
|
htmlFor: "for",
|
||||||
httpEquiv: 'http-equiv'
|
httpEquiv: "http-equiv"
|
||||||
};
|
};
|
||||||
/**
|
const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
|
||||||
* Known attributes, this is used for stringification of runtime static nodes
|
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
|
||||||
* so that we don't stringify bindings that cannot be set from HTML.
|
);
|
||||||
* Don't also forget to allow `data-*` and `aria-*`!
|
const isKnownSvgAttr = /* @__PURE__ */ makeMap(
|
||||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
|
||||||
*/
|
);
|
||||||
const isKnownHtmlAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
|
|
||||||
`autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +
|
|
||||||
`border,buffered,capture,challenge,charset,checked,cite,class,code,` +
|
|
||||||
`codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,` +
|
|
||||||
`coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,` +
|
|
||||||
`disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,` +
|
|
||||||
`formaction,formenctype,formmethod,formnovalidate,formtarget,headers,` +
|
|
||||||
`height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,` +
|
|
||||||
`ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` +
|
|
||||||
`manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` +
|
|
||||||
`open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` +
|
|
||||||
`referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` +
|
|
||||||
`selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` +
|
|
||||||
`start,step,style,summary,tabindex,target,title,translate,type,usemap,` +
|
|
||||||
`value,width,wrap`);
|
|
||||||
/**
|
|
||||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
|
||||||
*/
|
|
||||||
const isKnownSvgAttr = /*#__PURE__*/ makeMap(`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,` +
|
|
||||||
`arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,` +
|
|
||||||
`baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,` +
|
|
||||||
`clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,` +
|
|
||||||
`color-interpolation-filters,color-profile,color-rendering,` +
|
|
||||||
`contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,` +
|
|
||||||
`descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,` +
|
|
||||||
`dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,` +
|
|
||||||
`fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,` +
|
|
||||||
`font-family,font-size,font-size-adjust,font-stretch,font-style,` +
|
|
||||||
`font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,` +
|
|
||||||
`glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,` +
|
|
||||||
`gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,` +
|
|
||||||
`horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,` +
|
|
||||||
`k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,` +
|
|
||||||
`lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,` +
|
|
||||||
`marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,` +
|
|
||||||
`mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,` +
|
|
||||||
`name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,` +
|
|
||||||
`overflow,overline-position,overline-thickness,panose-1,paint-order,path,` +
|
|
||||||
`pathLength,patternContentUnits,patternTransform,patternUnits,ping,` +
|
|
||||||
`pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,` +
|
|
||||||
`preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,` +
|
|
||||||
`rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,` +
|
|
||||||
`restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,` +
|
|
||||||
`specularConstant,specularExponent,speed,spreadMethod,startOffset,` +
|
|
||||||
`stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,` +
|
|
||||||
`strikethrough-position,strikethrough-thickness,string,stroke,` +
|
|
||||||
`stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,` +
|
|
||||||
`stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,` +
|
|
||||||
`systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,` +
|
|
||||||
`text-decoration,text-rendering,textLength,to,transform,transform-origin,` +
|
|
||||||
`type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,` +
|
|
||||||
`unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,` +
|
|
||||||
`v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,` +
|
|
||||||
`vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,` +
|
|
||||||
`writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,` +
|
|
||||||
`xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,` +
|
|
||||||
`xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`);
|
|
||||||
|
|
||||||
const escapeRE = /["'&<>]/;
|
const escapeRE = /["'&<>]/;
|
||||||
function escapeHtml(string) {
|
function escapeHtml(string) {
|
||||||
const str = '' + string;
|
const str = "" + string;
|
||||||
const match = escapeRE.exec(str);
|
const match = escapeRE.exec(str);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
let html = '';
|
let html = "";
|
||||||
let escaped;
|
let escaped;
|
||||||
let index;
|
let index;
|
||||||
let lastIndex = 0;
|
let lastIndex = 0;
|
||||||
for (index = match.index; index < str.length; index++) {
|
for (index = match.index; index < str.length; index++) {
|
||||||
switch (str.charCodeAt(index)) {
|
switch (str.charCodeAt(index)) {
|
||||||
case 34: // "
|
case 34:
|
||||||
escaped = '"';
|
escaped = """;
|
||||||
break;
|
break;
|
||||||
case 38: // &
|
case 38:
|
||||||
escaped = '&';
|
escaped = "&";
|
||||||
break;
|
break;
|
||||||
case 39: // '
|
case 39:
|
||||||
escaped = ''';
|
escaped = "'";
|
||||||
break;
|
break;
|
||||||
case 60: // <
|
case 60:
|
||||||
escaped = '<';
|
escaped = "<";
|
||||||
break;
|
break;
|
||||||
case 62: // >
|
case 62:
|
||||||
escaped = '>';
|
escaped = ">";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
@ -372,10 +329,9 @@ function escapeHtml(string) {
|
|||||||
}
|
}
|
||||||
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
||||||
}
|
}
|
||||||
// https://www.w3.org/TR/html52/syntax.html#comments
|
|
||||||
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
||||||
function escapeHtmlComment(src) {
|
function escapeHtmlComment(src) {
|
||||||
return src.replace(commentStripRE, '');
|
return src.replace(commentStripRE, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
function looseCompareArrays(a, b) {
|
function looseCompareArrays(a, b) {
|
||||||
@ -408,7 +364,6 @@ function looseEqual(a, b) {
|
|||||||
aValidType = isObject(a);
|
aValidType = isObject(a);
|
||||||
bValidType = isObject(b);
|
bValidType = isObject(b);
|
||||||
if (aValidType || bValidType) {
|
if (aValidType || bValidType) {
|
||||||
/* istanbul ignore if: this if will probably never be called */
|
|
||||||
if (!aValidType || !bValidType) {
|
if (!aValidType || !bValidType) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -420,9 +375,7 @@ function looseEqual(a, b) {
|
|||||||
for (const key in a) {
|
for (const key in a) {
|
||||||
const aHasKey = a.hasOwnProperty(key);
|
const aHasKey = a.hasOwnProperty(key);
|
||||||
const bHasKey = b.hasOwnProperty(key);
|
const bHasKey = b.hasOwnProperty(key);
|
||||||
if ((aHasKey && !bHasKey) ||
|
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
|
||||||
(!aHasKey && bHasKey) ||
|
|
||||||
!looseEqual(a[key], b[key])) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -430,163 +383,32 @@ function looseEqual(a, b) {
|
|||||||
return String(a) === String(b);
|
return String(a) === String(b);
|
||||||
}
|
}
|
||||||
function looseIndexOf(arr, val) {
|
function looseIndexOf(arr, val) {
|
||||||
return arr.findIndex(item => looseEqual(item, val));
|
return arr.findIndex((item) => looseEqual(item, val));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* For converting {{ interpolation }} values to displayed strings.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
const toDisplayString = (val) => {
|
const toDisplayString = (val) => {
|
||||||
return isString(val)
|
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
|
||||||
? val
|
|
||||||
: val == null
|
|
||||||
? ''
|
|
||||||
: isArray(val) ||
|
|
||||||
(isObject(val) &&
|
|
||||||
(val.toString === objectToString || !isFunction(val.toString)))
|
|
||||||
? JSON.stringify(val, replacer, 2)
|
|
||||||
: String(val);
|
|
||||||
};
|
};
|
||||||
const replacer = (_key, val) => {
|
const replacer = (_key, val) => {
|
||||||
// can't use isRef here since @vue/shared has no deps
|
|
||||||
if (val && val.__v_isRef) {
|
if (val && val.__v_isRef) {
|
||||||
return replacer(_key, val.value);
|
return replacer(_key, val.value);
|
||||||
}
|
} else if (isMap(val)) {
|
||||||
else if (isMap(val)) {
|
|
||||||
return {
|
return {
|
||||||
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {
|
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
|
||||||
entries[`${key} =>`] = val;
|
entries[`${key} =>`] = val2;
|
||||||
return entries;
|
return entries;
|
||||||
}, {})
|
}, {})
|
||||||
};
|
};
|
||||||
}
|
} else if (isSet(val)) {
|
||||||
else if (isSet(val)) {
|
|
||||||
return {
|
return {
|
||||||
[`Set(${val.size})`]: [...val.values()]
|
[`Set(${val.size})`]: [...val.values()]
|
||||||
};
|
};
|
||||||
}
|
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
||||||
else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
|
||||||
return String(val);
|
return String(val);
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
};
|
};
|
||||||
|
|
||||||
const EMPTY_OBJ = Object.freeze({})
|
|
||||||
;
|
|
||||||
const EMPTY_ARR = Object.freeze([]) ;
|
|
||||||
const NOOP = () => { };
|
|
||||||
/**
|
|
||||||
* Always return false.
|
|
||||||
*/
|
|
||||||
const NO = () => false;
|
|
||||||
const onRE = /^on[^a-z]/;
|
|
||||||
const isOn = (key) => onRE.test(key);
|
|
||||||
const isModelListener = (key) => key.startsWith('onUpdate:');
|
|
||||||
const extend = Object.assign;
|
|
||||||
const remove = (arr, el) => {
|
|
||||||
const i = arr.indexOf(el);
|
|
||||||
if (i > -1) {
|
|
||||||
arr.splice(i, 1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
||||||
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
||||||
const isArray = Array.isArray;
|
|
||||||
const isMap = (val) => toTypeString(val) === '[object Map]';
|
|
||||||
const isSet = (val) => toTypeString(val) === '[object Set]';
|
|
||||||
const isDate = (val) => toTypeString(val) === '[object Date]';
|
|
||||||
const isFunction = (val) => typeof val === 'function';
|
|
||||||
const isString = (val) => typeof val === 'string';
|
|
||||||
const isSymbol = (val) => typeof val === 'symbol';
|
|
||||||
const isObject = (val) => val !== null && typeof val === 'object';
|
|
||||||
const isPromise = (val) => {
|
|
||||||
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
||||||
};
|
|
||||||
const objectToString = Object.prototype.toString;
|
|
||||||
const toTypeString = (value) => objectToString.call(value);
|
|
||||||
const toRawType = (value) => {
|
|
||||||
// extract "RawType" from strings like "[object RawType]"
|
|
||||||
return toTypeString(value).slice(8, -1);
|
|
||||||
};
|
|
||||||
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
|
|
||||||
const isIntegerKey = (key) => isString(key) &&
|
|
||||||
key !== 'NaN' &&
|
|
||||||
key[0] !== '-' &&
|
|
||||||
'' + parseInt(key, 10) === key;
|
|
||||||
const isReservedProp = /*#__PURE__*/ makeMap(
|
|
||||||
// the leading comma is intentional so empty string "" is also included
|
|
||||||
',key,ref,ref_for,ref_key,' +
|
|
||||||
'onVnodeBeforeMount,onVnodeMounted,' +
|
|
||||||
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
|
||||||
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
|
||||||
const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
|
|
||||||
const cacheStringFunction = (fn) => {
|
|
||||||
const cache = Object.create(null);
|
|
||||||
return ((str) => {
|
|
||||||
const hit = cache[str];
|
|
||||||
return hit || (cache[str] = fn(str));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const camelizeRE = /-(\w)/g;
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
const camelize = cacheStringFunction((str) => {
|
|
||||||
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
|
|
||||||
});
|
|
||||||
const hyphenateRE = /\B([A-Z])/g;
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
const toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
|
|
||||||
// compare whether a value has changed, accounting for NaN.
|
|
||||||
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
||||||
const invokeArrayFns = (fns, arg) => {
|
|
||||||
for (let i = 0; i < fns.length; i++) {
|
|
||||||
fns[i](arg);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const def = (obj, key, value) => {
|
|
||||||
Object.defineProperty(obj, key, {
|
|
||||||
configurable: true,
|
|
||||||
enumerable: false,
|
|
||||||
value
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const toNumber = (val) => {
|
|
||||||
const n = parseFloat(val);
|
|
||||||
return isNaN(n) ? val : n;
|
|
||||||
};
|
|
||||||
let _globalThis;
|
|
||||||
const getGlobalThis = () => {
|
|
||||||
return (_globalThis ||
|
|
||||||
(_globalThis =
|
|
||||||
typeof globalThis !== 'undefined'
|
|
||||||
? globalThis
|
|
||||||
: typeof self !== 'undefined'
|
|
||||||
? self
|
|
||||||
: typeof window !== 'undefined'
|
|
||||||
? window
|
|
||||||
: typeof global !== 'undefined'
|
|
||||||
? global
|
|
||||||
: {}));
|
|
||||||
};
|
|
||||||
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
|
||||||
function genPropsAccessExp(name) {
|
|
||||||
return identRE.test(name)
|
|
||||||
? `__props.${name}`
|
|
||||||
: `__props[${JSON.stringify(name)}]`;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.EMPTY_ARR = EMPTY_ARR;
|
exports.EMPTY_ARR = EMPTY_ARR;
|
||||||
exports.EMPTY_OBJ = EMPTY_OBJ;
|
exports.EMPTY_OBJ = EMPTY_OBJ;
|
||||||
exports.NO = NO;
|
exports.NO = NO;
|
||||||
@ -622,6 +444,7 @@ exports.isObject = isObject;
|
|||||||
exports.isOn = isOn;
|
exports.isOn = isOn;
|
||||||
exports.isPlainObject = isPlainObject;
|
exports.isPlainObject = isPlainObject;
|
||||||
exports.isPromise = isPromise;
|
exports.isPromise = isPromise;
|
||||||
|
exports.isRegExp = isRegExp;
|
||||||
exports.isReservedProp = isReservedProp;
|
exports.isReservedProp = isReservedProp;
|
||||||
exports.isSSRSafeAttrName = isSSRSafeAttrName;
|
exports.isSSRSafeAttrName = isSSRSafeAttrName;
|
||||||
exports.isSVGTag = isSVGTag;
|
exports.isSVGTag = isSVGTag;
|
||||||
@ -632,6 +455,7 @@ exports.isSymbol = isSymbol;
|
|||||||
exports.isVoidTag = isVoidTag;
|
exports.isVoidTag = isVoidTag;
|
||||||
exports.looseEqual = looseEqual;
|
exports.looseEqual = looseEqual;
|
||||||
exports.looseIndexOf = looseIndexOf;
|
exports.looseIndexOf = looseIndexOf;
|
||||||
|
exports.looseToNumber = looseToNumber;
|
||||||
exports.makeMap = makeMap;
|
exports.makeMap = makeMap;
|
||||||
exports.normalizeClass = normalizeClass;
|
exports.normalizeClass = normalizeClass;
|
||||||
exports.normalizeProps = normalizeProps;
|
exports.normalizeProps = normalizeProps;
|
||||||
|
@ -2,90 +2,165 @@
|
|||||||
|
|
||||||
Object.defineProperty(exports, '__esModule', { value: true });
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a map and return a function for checking if a key
|
|
||||||
* is in that map.
|
|
||||||
* IMPORTANT: all calls of this function must be prefixed with
|
|
||||||
* \/\*#\_\_PURE\_\_\*\/
|
|
||||||
* So that rollup can tree-shake them if necessary.
|
|
||||||
*/
|
|
||||||
function makeMap(str, expectsLowerCase) {
|
function makeMap(str, expectsLowerCase) {
|
||||||
const map = Object.create(null);
|
const map = /* @__PURE__ */ Object.create(null);
|
||||||
const list = str.split(',');
|
const list = str.split(",");
|
||||||
for (let i = 0; i < list.length; i++) {
|
for (let i = 0; i < list.length; i++) {
|
||||||
map[list[i]] = true;
|
map[list[i]] = true;
|
||||||
}
|
}
|
||||||
return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
|
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
|
||||||
|
}
|
||||||
|
|
||||||
|
const EMPTY_OBJ = {};
|
||||||
|
const EMPTY_ARR = [];
|
||||||
|
const NOOP = () => {
|
||||||
|
};
|
||||||
|
const NO = () => false;
|
||||||
|
const onRE = /^on[^a-z]/;
|
||||||
|
const isOn = (key) => onRE.test(key);
|
||||||
|
const isModelListener = (key) => key.startsWith("onUpdate:");
|
||||||
|
const extend = Object.assign;
|
||||||
|
const remove = (arr, el) => {
|
||||||
|
const i = arr.indexOf(el);
|
||||||
|
if (i > -1) {
|
||||||
|
arr.splice(i, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||||
|
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||||
|
const isArray = Array.isArray;
|
||||||
|
const isMap = (val) => toTypeString(val) === "[object Map]";
|
||||||
|
const isSet = (val) => toTypeString(val) === "[object Set]";
|
||||||
|
const isDate = (val) => toTypeString(val) === "[object Date]";
|
||||||
|
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
||||||
|
const isFunction = (val) => typeof val === "function";
|
||||||
|
const isString = (val) => typeof val === "string";
|
||||||
|
const isSymbol = (val) => typeof val === "symbol";
|
||||||
|
const isObject = (val) => val !== null && typeof val === "object";
|
||||||
|
const isPromise = (val) => {
|
||||||
|
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
||||||
|
};
|
||||||
|
const objectToString = Object.prototype.toString;
|
||||||
|
const toTypeString = (value) => objectToString.call(value);
|
||||||
|
const toRawType = (value) => {
|
||||||
|
return toTypeString(value).slice(8, -1);
|
||||||
|
};
|
||||||
|
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
||||||
|
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
||||||
|
const isReservedProp = /* @__PURE__ */ makeMap(
|
||||||
|
// the leading comma is intentional so empty string "" is also included
|
||||||
|
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
||||||
|
);
|
||||||
|
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
||||||
|
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
||||||
|
);
|
||||||
|
const cacheStringFunction = (fn) => {
|
||||||
|
const cache = /* @__PURE__ */ Object.create(null);
|
||||||
|
return (str) => {
|
||||||
|
const hit = cache[str];
|
||||||
|
return hit || (cache[str] = fn(str));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
const camelizeRE = /-(\w)/g;
|
||||||
|
const camelize = cacheStringFunction((str) => {
|
||||||
|
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
||||||
|
});
|
||||||
|
const hyphenateRE = /\B([A-Z])/g;
|
||||||
|
const hyphenate = cacheStringFunction(
|
||||||
|
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
||||||
|
);
|
||||||
|
const capitalize = cacheStringFunction(
|
||||||
|
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
||||||
|
);
|
||||||
|
const toHandlerKey = cacheStringFunction(
|
||||||
|
(str) => str ? `on${capitalize(str)}` : ``
|
||||||
|
);
|
||||||
|
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
||||||
|
const invokeArrayFns = (fns, arg) => {
|
||||||
|
for (let i = 0; i < fns.length; i++) {
|
||||||
|
fns[i](arg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const def = (obj, key, value) => {
|
||||||
|
Object.defineProperty(obj, key, {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: false,
|
||||||
|
value
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const looseToNumber = (val) => {
|
||||||
|
const n = parseFloat(val);
|
||||||
|
return isNaN(n) ? val : n;
|
||||||
|
};
|
||||||
|
const toNumber = (val) => {
|
||||||
|
const n = isString(val) ? Number(val) : NaN;
|
||||||
|
return isNaN(n) ? val : n;
|
||||||
|
};
|
||||||
|
let _globalThis;
|
||||||
|
const getGlobalThis = () => {
|
||||||
|
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
||||||
|
};
|
||||||
|
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
||||||
|
function genPropsAccessExp(name) {
|
||||||
|
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* dev only flag -> name mapping
|
|
||||||
*/
|
|
||||||
const PatchFlagNames = {
|
const PatchFlagNames = {
|
||||||
[1 /* PatchFlags.TEXT */]: `TEXT`,
|
[1]: `TEXT`,
|
||||||
[2 /* PatchFlags.CLASS */]: `CLASS`,
|
[2]: `CLASS`,
|
||||||
[4 /* PatchFlags.STYLE */]: `STYLE`,
|
[4]: `STYLE`,
|
||||||
[8 /* PatchFlags.PROPS */]: `PROPS`,
|
[8]: `PROPS`,
|
||||||
[16 /* PatchFlags.FULL_PROPS */]: `FULL_PROPS`,
|
[16]: `FULL_PROPS`,
|
||||||
[32 /* PatchFlags.HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
|
[32]: `HYDRATE_EVENTS`,
|
||||||
[64 /* PatchFlags.STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
|
[64]: `STABLE_FRAGMENT`,
|
||||||
[128 /* PatchFlags.KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
|
[128]: `KEYED_FRAGMENT`,
|
||||||
[256 /* PatchFlags.UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
|
[256]: `UNKEYED_FRAGMENT`,
|
||||||
[512 /* PatchFlags.NEED_PATCH */]: `NEED_PATCH`,
|
[512]: `NEED_PATCH`,
|
||||||
[1024 /* PatchFlags.DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
|
[1024]: `DYNAMIC_SLOTS`,
|
||||||
[2048 /* PatchFlags.DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
|
[2048]: `DEV_ROOT_FRAGMENT`,
|
||||||
[-1 /* PatchFlags.HOISTED */]: `HOISTED`,
|
[-1]: `HOISTED`,
|
||||||
[-2 /* PatchFlags.BAIL */]: `BAIL`
|
[-2]: `BAIL`
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Dev only
|
|
||||||
*/
|
|
||||||
const slotFlagsText = {
|
const slotFlagsText = {
|
||||||
[1 /* SlotFlags.STABLE */]: 'STABLE',
|
[1]: "STABLE",
|
||||||
[2 /* SlotFlags.DYNAMIC */]: 'DYNAMIC',
|
[2]: "DYNAMIC",
|
||||||
[3 /* SlotFlags.FORWARDED */]: 'FORWARDED'
|
[3]: "FORWARDED"
|
||||||
};
|
};
|
||||||
|
|
||||||
const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
|
const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
|
||||||
'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
|
const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
|
||||||
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
|
|
||||||
const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
|
|
||||||
|
|
||||||
const range = 2;
|
const range = 2;
|
||||||
function generateCodeFrame(source, start = 0, end = source.length) {
|
function generateCodeFrame(source, start = 0, end = source.length) {
|
||||||
// Split the content into individual lines but capture the newline sequence
|
|
||||||
// that separated each line. This is important because the actual sequence is
|
|
||||||
// needed to properly take into account the full line length for offset
|
|
||||||
// comparison
|
|
||||||
let lines = source.split(/(\r?\n)/);
|
let lines = source.split(/(\r?\n)/);
|
||||||
// Separate the lines and newline sequences into separate arrays for easier referencing
|
|
||||||
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
||||||
lines = lines.filter((_, idx) => idx % 2 === 0);
|
lines = lines.filter((_, idx) => idx % 2 === 0);
|
||||||
let count = 0;
|
let count = 0;
|
||||||
const res = [];
|
const res = [];
|
||||||
for (let i = 0; i < lines.length; i++) {
|
for (let i = 0; i < lines.length; i++) {
|
||||||
count +=
|
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
|
||||||
lines[i].length +
|
|
||||||
((newlineSequences[i] && newlineSequences[i].length) || 0);
|
|
||||||
if (count >= start) {
|
if (count >= start) {
|
||||||
for (let j = i - range; j <= i + range || end > count; j++) {
|
for (let j = i - range; j <= i + range || end > count; j++) {
|
||||||
if (j < 0 || j >= lines.length)
|
if (j < 0 || j >= lines.length)
|
||||||
continue;
|
continue;
|
||||||
const line = j + 1;
|
const line = j + 1;
|
||||||
res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
|
res.push(
|
||||||
|
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
|
||||||
|
);
|
||||||
const lineLength = lines[j].length;
|
const lineLength = lines[j].length;
|
||||||
const newLineSeqLength = (newlineSequences[j] && newlineSequences[j].length) || 0;
|
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
|
||||||
if (j === i) {
|
if (j === i) {
|
||||||
// push underline
|
|
||||||
const pad = start - (count - (lineLength + newLineSeqLength));
|
const pad = start - (count - (lineLength + newLineSeqLength));
|
||||||
const length = Math.max(1, end > count ? lineLength - pad : end - start);
|
const length = Math.max(
|
||||||
res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));
|
1,
|
||||||
}
|
end > count ? lineLength - pad : end - start
|
||||||
else if (j > i) {
|
);
|
||||||
|
res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
|
||||||
|
} else if (j > i) {
|
||||||
if (end > count) {
|
if (end > count) {
|
||||||
const length = Math.max(Math.min(end - count, lineLength), 1);
|
const length = Math.max(Math.min(end - count, lineLength), 1);
|
||||||
res.push(` | ` + '^'.repeat(length));
|
res.push(` | ` + "^".repeat(length));
|
||||||
}
|
}
|
||||||
count += lineLength + newLineSeqLength;
|
count += lineLength + newLineSeqLength;
|
||||||
}
|
}
|
||||||
@ -93,7 +168,7 @@ function generateCodeFrame(source, start = 0, end = source.length) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res.join('\n');
|
return res.join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeStyle(value) {
|
function normalizeStyle(value) {
|
||||||
@ -101,9 +176,7 @@ function normalizeStyle(value) {
|
|||||||
const res = {};
|
const res = {};
|
||||||
for (let i = 0; i < value.length; i++) {
|
for (let i = 0; i < value.length; i++) {
|
||||||
const item = value[i];
|
const item = value[i];
|
||||||
const normalized = isString(item)
|
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
||||||
? parseStringStyle(item)
|
|
||||||
: normalizeStyle(item);
|
|
||||||
if (normalized) {
|
if (normalized) {
|
||||||
for (const key in normalized) {
|
for (const key in normalized) {
|
||||||
res[key] = normalized[key];
|
res[key] = normalized[key];
|
||||||
@ -111,23 +184,18 @@ function normalizeStyle(value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
} else if (isString(value)) {
|
||||||
else if (isString(value)) {
|
|
||||||
return value;
|
return value;
|
||||||
}
|
} else if (isObject(value)) {
|
||||||
else if (isObject(value)) {
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const listDelimiterRE = /;(?![^(]*\))/g;
|
const listDelimiterRE = /;(?![^(]*\))/g;
|
||||||
const propertyDelimiterRE = /:([^]+)/;
|
const propertyDelimiterRE = /:([^]+)/;
|
||||||
const styleCommentRE = /\/\*.*?\*\//gs;
|
const styleCommentRE = /\/\*[^]*?\*\//g;
|
||||||
function parseStringStyle(cssText) {
|
function parseStringStyle(cssText) {
|
||||||
const ret = {};
|
const ret = {};
|
||||||
cssText
|
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
||||||
.replace(styleCommentRE, '')
|
|
||||||
.split(listDelimiterRE)
|
|
||||||
.forEach(item => {
|
|
||||||
if (item) {
|
if (item) {
|
||||||
const tmp = item.split(propertyDelimiterRE);
|
const tmp = item.split(propertyDelimiterRE);
|
||||||
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
||||||
@ -136,37 +204,34 @@ function parseStringStyle(cssText) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
function stringifyStyle(styles) {
|
function stringifyStyle(styles) {
|
||||||
let ret = '';
|
let ret = "";
|
||||||
if (!styles || isString(styles)) {
|
if (!styles || isString(styles)) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
for (const key in styles) {
|
for (const key in styles) {
|
||||||
const value = styles[key];
|
const value = styles[key];
|
||||||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
||||||
if (isString(value) || typeof value === 'number') {
|
if (isString(value) || typeof value === "number") {
|
||||||
// only render valid values
|
|
||||||
ret += `${normalizedKey}:${value};`;
|
ret += `${normalizedKey}:${value};`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
function normalizeClass(value) {
|
function normalizeClass(value) {
|
||||||
let res = '';
|
let res = "";
|
||||||
if (isString(value)) {
|
if (isString(value)) {
|
||||||
res = value;
|
res = value;
|
||||||
}
|
} else if (isArray(value)) {
|
||||||
else if (isArray(value)) {
|
|
||||||
for (let i = 0; i < value.length; i++) {
|
for (let i = 0; i < value.length; i++) {
|
||||||
const normalized = normalizeClass(value[i]);
|
const normalized = normalizeClass(value[i]);
|
||||||
if (normalized) {
|
if (normalized) {
|
||||||
res += normalized + ' ';
|
res += normalized + " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (isObject(value)) {
|
||||||
else if (isObject(value)) {
|
|
||||||
for (const name in value) {
|
for (const name in value) {
|
||||||
if (value[name]) {
|
if (value[name]) {
|
||||||
res += name + ' ';
|
res += name + " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,71 +250,20 @@ function normalizeProps(props) {
|
|||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
// These tag configs are shared between compiler-dom and runtime-dom, so they
|
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
|
||||||
const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
|
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
|
||||||
'header,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
|
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
|
||||||
'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
|
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
|
||||||
'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +
|
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
|
||||||
'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
|
|
||||||
'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
|
|
||||||
'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
|
|
||||||
'option,output,progress,select,textarea,details,dialog,menu,' +
|
|
||||||
'summary,template,blockquote,iframe,tfoot';
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/SVG/Element
|
|
||||||
const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
|
|
||||||
'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
|
|
||||||
'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
|
|
||||||
'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
|
|
||||||
'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
|
|
||||||
'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
|
|
||||||
'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
|
|
||||||
'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
|
|
||||||
'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
|
|
||||||
'text,textPath,title,tspan,unknown,use,view';
|
|
||||||
const VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
|
|
||||||
/**
|
|
||||||
* Compiler only.
|
|
||||||
* Do NOT use in runtime code paths unless behind `false` flag.
|
|
||||||
*/
|
|
||||||
const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
|
|
||||||
/**
|
|
||||||
* Compiler only.
|
|
||||||
* Do NOT use in runtime code paths unless behind `false` flag.
|
|
||||||
*/
|
|
||||||
const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
|
|
||||||
/**
|
|
||||||
* Compiler only.
|
|
||||||
* Do NOT use in runtime code paths unless behind `false` flag.
|
|
||||||
*/
|
|
||||||
const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On the client we only need to offer special cases for boolean attributes that
|
|
||||||
* have different names from their corresponding dom properties:
|
|
||||||
* - itemscope -> N/A
|
|
||||||
* - allowfullscreen -> allowFullscreen
|
|
||||||
* - formnovalidate -> formNoValidate
|
|
||||||
* - ismap -> isMap
|
|
||||||
* - nomodule -> noModule
|
|
||||||
* - novalidate -> noValidate
|
|
||||||
* - readonly -> readOnly
|
|
||||||
*/
|
|
||||||
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
||||||
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
|
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
|
||||||
/**
|
const isBooleanAttr = /* @__PURE__ */ makeMap(
|
||||||
* The full list is needed during SSR to produce the correct initial markup.
|
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
|
||||||
*/
|
);
|
||||||
const isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +
|
|
||||||
`,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +
|
|
||||||
`loop,open,required,reversed,scoped,seamless,` +
|
|
||||||
`checked,muted,multiple,selected`);
|
|
||||||
/**
|
|
||||||
* Boolean attributes should be included if the value is truthy or ''.
|
|
||||||
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
||||||
*/
|
|
||||||
function includeBooleanAttr(value) {
|
function includeBooleanAttr(value) {
|
||||||
return !!value || value === '';
|
return !!value || value === "";
|
||||||
}
|
}
|
||||||
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
||||||
const attrValidationCache = {};
|
const attrValidationCache = {};
|
||||||
@ -261,105 +275,48 @@ function isSSRSafeAttrName(name) {
|
|||||||
if (isUnsafe) {
|
if (isUnsafe) {
|
||||||
console.error(`unsafe attribute name: ${name}`);
|
console.error(`unsafe attribute name: ${name}`);
|
||||||
}
|
}
|
||||||
return (attrValidationCache[name] = !isUnsafe);
|
return attrValidationCache[name] = !isUnsafe;
|
||||||
}
|
}
|
||||||
const propsToAttrMap = {
|
const propsToAttrMap = {
|
||||||
acceptCharset: 'accept-charset',
|
acceptCharset: "accept-charset",
|
||||||
className: 'class',
|
className: "class",
|
||||||
htmlFor: 'for',
|
htmlFor: "for",
|
||||||
httpEquiv: 'http-equiv'
|
httpEquiv: "http-equiv"
|
||||||
};
|
};
|
||||||
/**
|
const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
|
||||||
* Known attributes, this is used for stringification of runtime static nodes
|
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
|
||||||
* so that we don't stringify bindings that cannot be set from HTML.
|
);
|
||||||
* Don't also forget to allow `data-*` and `aria-*`!
|
const isKnownSvgAttr = /* @__PURE__ */ makeMap(
|
||||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
|
||||||
*/
|
);
|
||||||
const isKnownHtmlAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
|
|
||||||
`autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +
|
|
||||||
`border,buffered,capture,challenge,charset,checked,cite,class,code,` +
|
|
||||||
`codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,` +
|
|
||||||
`coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,` +
|
|
||||||
`disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,` +
|
|
||||||
`formaction,formenctype,formmethod,formnovalidate,formtarget,headers,` +
|
|
||||||
`height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,` +
|
|
||||||
`ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` +
|
|
||||||
`manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` +
|
|
||||||
`open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` +
|
|
||||||
`referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` +
|
|
||||||
`selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` +
|
|
||||||
`start,step,style,summary,tabindex,target,title,translate,type,usemap,` +
|
|
||||||
`value,width,wrap`);
|
|
||||||
/**
|
|
||||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
|
||||||
*/
|
|
||||||
const isKnownSvgAttr = /*#__PURE__*/ makeMap(`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,` +
|
|
||||||
`arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,` +
|
|
||||||
`baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,` +
|
|
||||||
`clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,` +
|
|
||||||
`color-interpolation-filters,color-profile,color-rendering,` +
|
|
||||||
`contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,` +
|
|
||||||
`descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,` +
|
|
||||||
`dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,` +
|
|
||||||
`fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,` +
|
|
||||||
`font-family,font-size,font-size-adjust,font-stretch,font-style,` +
|
|
||||||
`font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,` +
|
|
||||||
`glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,` +
|
|
||||||
`gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,` +
|
|
||||||
`horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,` +
|
|
||||||
`k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,` +
|
|
||||||
`lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,` +
|
|
||||||
`marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,` +
|
|
||||||
`mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,` +
|
|
||||||
`name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,` +
|
|
||||||
`overflow,overline-position,overline-thickness,panose-1,paint-order,path,` +
|
|
||||||
`pathLength,patternContentUnits,patternTransform,patternUnits,ping,` +
|
|
||||||
`pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,` +
|
|
||||||
`preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,` +
|
|
||||||
`rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,` +
|
|
||||||
`restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,` +
|
|
||||||
`specularConstant,specularExponent,speed,spreadMethod,startOffset,` +
|
|
||||||
`stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,` +
|
|
||||||
`strikethrough-position,strikethrough-thickness,string,stroke,` +
|
|
||||||
`stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,` +
|
|
||||||
`stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,` +
|
|
||||||
`systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,` +
|
|
||||||
`text-decoration,text-rendering,textLength,to,transform,transform-origin,` +
|
|
||||||
`type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,` +
|
|
||||||
`unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,` +
|
|
||||||
`v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,` +
|
|
||||||
`vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,` +
|
|
||||||
`writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,` +
|
|
||||||
`xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,` +
|
|
||||||
`xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`);
|
|
||||||
|
|
||||||
const escapeRE = /["'&<>]/;
|
const escapeRE = /["'&<>]/;
|
||||||
function escapeHtml(string) {
|
function escapeHtml(string) {
|
||||||
const str = '' + string;
|
const str = "" + string;
|
||||||
const match = escapeRE.exec(str);
|
const match = escapeRE.exec(str);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
let html = '';
|
let html = "";
|
||||||
let escaped;
|
let escaped;
|
||||||
let index;
|
let index;
|
||||||
let lastIndex = 0;
|
let lastIndex = 0;
|
||||||
for (index = match.index; index < str.length; index++) {
|
for (index = match.index; index < str.length; index++) {
|
||||||
switch (str.charCodeAt(index)) {
|
switch (str.charCodeAt(index)) {
|
||||||
case 34: // "
|
case 34:
|
||||||
escaped = '"';
|
escaped = """;
|
||||||
break;
|
break;
|
||||||
case 38: // &
|
case 38:
|
||||||
escaped = '&';
|
escaped = "&";
|
||||||
break;
|
break;
|
||||||
case 39: // '
|
case 39:
|
||||||
escaped = ''';
|
escaped = "'";
|
||||||
break;
|
break;
|
||||||
case 60: // <
|
case 60:
|
||||||
escaped = '<';
|
escaped = "<";
|
||||||
break;
|
break;
|
||||||
case 62: // >
|
case 62:
|
||||||
escaped = '>';
|
escaped = ">";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
@ -372,10 +329,9 @@ function escapeHtml(string) {
|
|||||||
}
|
}
|
||||||
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
||||||
}
|
}
|
||||||
// https://www.w3.org/TR/html52/syntax.html#comments
|
|
||||||
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
||||||
function escapeHtmlComment(src) {
|
function escapeHtmlComment(src) {
|
||||||
return src.replace(commentStripRE, '');
|
return src.replace(commentStripRE, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
function looseCompareArrays(a, b) {
|
function looseCompareArrays(a, b) {
|
||||||
@ -408,7 +364,6 @@ function looseEqual(a, b) {
|
|||||||
aValidType = isObject(a);
|
aValidType = isObject(a);
|
||||||
bValidType = isObject(b);
|
bValidType = isObject(b);
|
||||||
if (aValidType || bValidType) {
|
if (aValidType || bValidType) {
|
||||||
/* istanbul ignore if: this if will probably never be called */
|
|
||||||
if (!aValidType || !bValidType) {
|
if (!aValidType || !bValidType) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -420,9 +375,7 @@ function looseEqual(a, b) {
|
|||||||
for (const key in a) {
|
for (const key in a) {
|
||||||
const aHasKey = a.hasOwnProperty(key);
|
const aHasKey = a.hasOwnProperty(key);
|
||||||
const bHasKey = b.hasOwnProperty(key);
|
const bHasKey = b.hasOwnProperty(key);
|
||||||
if ((aHasKey && !bHasKey) ||
|
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
|
||||||
(!aHasKey && bHasKey) ||
|
|
||||||
!looseEqual(a[key], b[key])) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -430,162 +383,32 @@ function looseEqual(a, b) {
|
|||||||
return String(a) === String(b);
|
return String(a) === String(b);
|
||||||
}
|
}
|
||||||
function looseIndexOf(arr, val) {
|
function looseIndexOf(arr, val) {
|
||||||
return arr.findIndex(item => looseEqual(item, val));
|
return arr.findIndex((item) => looseEqual(item, val));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* For converting {{ interpolation }} values to displayed strings.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
const toDisplayString = (val) => {
|
const toDisplayString = (val) => {
|
||||||
return isString(val)
|
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
|
||||||
? val
|
|
||||||
: val == null
|
|
||||||
? ''
|
|
||||||
: isArray(val) ||
|
|
||||||
(isObject(val) &&
|
|
||||||
(val.toString === objectToString || !isFunction(val.toString)))
|
|
||||||
? JSON.stringify(val, replacer, 2)
|
|
||||||
: String(val);
|
|
||||||
};
|
};
|
||||||
const replacer = (_key, val) => {
|
const replacer = (_key, val) => {
|
||||||
// can't use isRef here since @vue/shared has no deps
|
|
||||||
if (val && val.__v_isRef) {
|
if (val && val.__v_isRef) {
|
||||||
return replacer(_key, val.value);
|
return replacer(_key, val.value);
|
||||||
}
|
} else if (isMap(val)) {
|
||||||
else if (isMap(val)) {
|
|
||||||
return {
|
return {
|
||||||
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {
|
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
|
||||||
entries[`${key} =>`] = val;
|
entries[`${key} =>`] = val2;
|
||||||
return entries;
|
return entries;
|
||||||
}, {})
|
}, {})
|
||||||
};
|
};
|
||||||
}
|
} else if (isSet(val)) {
|
||||||
else if (isSet(val)) {
|
|
||||||
return {
|
return {
|
||||||
[`Set(${val.size})`]: [...val.values()]
|
[`Set(${val.size})`]: [...val.values()]
|
||||||
};
|
};
|
||||||
}
|
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
||||||
else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
|
||||||
return String(val);
|
return String(val);
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
};
|
};
|
||||||
|
|
||||||
const EMPTY_OBJ = {};
|
|
||||||
const EMPTY_ARR = [];
|
|
||||||
const NOOP = () => { };
|
|
||||||
/**
|
|
||||||
* Always return false.
|
|
||||||
*/
|
|
||||||
const NO = () => false;
|
|
||||||
const onRE = /^on[^a-z]/;
|
|
||||||
const isOn = (key) => onRE.test(key);
|
|
||||||
const isModelListener = (key) => key.startsWith('onUpdate:');
|
|
||||||
const extend = Object.assign;
|
|
||||||
const remove = (arr, el) => {
|
|
||||||
const i = arr.indexOf(el);
|
|
||||||
if (i > -1) {
|
|
||||||
arr.splice(i, 1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
||||||
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
||||||
const isArray = Array.isArray;
|
|
||||||
const isMap = (val) => toTypeString(val) === '[object Map]';
|
|
||||||
const isSet = (val) => toTypeString(val) === '[object Set]';
|
|
||||||
const isDate = (val) => toTypeString(val) === '[object Date]';
|
|
||||||
const isFunction = (val) => typeof val === 'function';
|
|
||||||
const isString = (val) => typeof val === 'string';
|
|
||||||
const isSymbol = (val) => typeof val === 'symbol';
|
|
||||||
const isObject = (val) => val !== null && typeof val === 'object';
|
|
||||||
const isPromise = (val) => {
|
|
||||||
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
||||||
};
|
|
||||||
const objectToString = Object.prototype.toString;
|
|
||||||
const toTypeString = (value) => objectToString.call(value);
|
|
||||||
const toRawType = (value) => {
|
|
||||||
// extract "RawType" from strings like "[object RawType]"
|
|
||||||
return toTypeString(value).slice(8, -1);
|
|
||||||
};
|
|
||||||
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
|
|
||||||
const isIntegerKey = (key) => isString(key) &&
|
|
||||||
key !== 'NaN' &&
|
|
||||||
key[0] !== '-' &&
|
|
||||||
'' + parseInt(key, 10) === key;
|
|
||||||
const isReservedProp = /*#__PURE__*/ makeMap(
|
|
||||||
// the leading comma is intentional so empty string "" is also included
|
|
||||||
',key,ref,ref_for,ref_key,' +
|
|
||||||
'onVnodeBeforeMount,onVnodeMounted,' +
|
|
||||||
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
|
||||||
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
|
||||||
const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
|
|
||||||
const cacheStringFunction = (fn) => {
|
|
||||||
const cache = Object.create(null);
|
|
||||||
return ((str) => {
|
|
||||||
const hit = cache[str];
|
|
||||||
return hit || (cache[str] = fn(str));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const camelizeRE = /-(\w)/g;
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
const camelize = cacheStringFunction((str) => {
|
|
||||||
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
|
|
||||||
});
|
|
||||||
const hyphenateRE = /\B([A-Z])/g;
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
const toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
|
|
||||||
// compare whether a value has changed, accounting for NaN.
|
|
||||||
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
||||||
const invokeArrayFns = (fns, arg) => {
|
|
||||||
for (let i = 0; i < fns.length; i++) {
|
|
||||||
fns[i](arg);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const def = (obj, key, value) => {
|
|
||||||
Object.defineProperty(obj, key, {
|
|
||||||
configurable: true,
|
|
||||||
enumerable: false,
|
|
||||||
value
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const toNumber = (val) => {
|
|
||||||
const n = parseFloat(val);
|
|
||||||
return isNaN(n) ? val : n;
|
|
||||||
};
|
|
||||||
let _globalThis;
|
|
||||||
const getGlobalThis = () => {
|
|
||||||
return (_globalThis ||
|
|
||||||
(_globalThis =
|
|
||||||
typeof globalThis !== 'undefined'
|
|
||||||
? globalThis
|
|
||||||
: typeof self !== 'undefined'
|
|
||||||
? self
|
|
||||||
: typeof window !== 'undefined'
|
|
||||||
? window
|
|
||||||
: typeof global !== 'undefined'
|
|
||||||
? global
|
|
||||||
: {}));
|
|
||||||
};
|
|
||||||
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
|
||||||
function genPropsAccessExp(name) {
|
|
||||||
return identRE.test(name)
|
|
||||||
? `__props.${name}`
|
|
||||||
: `__props[${JSON.stringify(name)}]`;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.EMPTY_ARR = EMPTY_ARR;
|
exports.EMPTY_ARR = EMPTY_ARR;
|
||||||
exports.EMPTY_OBJ = EMPTY_OBJ;
|
exports.EMPTY_OBJ = EMPTY_OBJ;
|
||||||
exports.NO = NO;
|
exports.NO = NO;
|
||||||
@ -621,6 +444,7 @@ exports.isObject = isObject;
|
|||||||
exports.isOn = isOn;
|
exports.isOn = isOn;
|
||||||
exports.isPlainObject = isPlainObject;
|
exports.isPlainObject = isPlainObject;
|
||||||
exports.isPromise = isPromise;
|
exports.isPromise = isPromise;
|
||||||
|
exports.isRegExp = isRegExp;
|
||||||
exports.isReservedProp = isReservedProp;
|
exports.isReservedProp = isReservedProp;
|
||||||
exports.isSSRSafeAttrName = isSSRSafeAttrName;
|
exports.isSSRSafeAttrName = isSSRSafeAttrName;
|
||||||
exports.isSVGTag = isSVGTag;
|
exports.isSVGTag = isSVGTag;
|
||||||
@ -631,6 +455,7 @@ exports.isSymbol = isSymbol;
|
|||||||
exports.isVoidTag = isVoidTag;
|
exports.isVoidTag = isVoidTag;
|
||||||
exports.looseEqual = looseEqual;
|
exports.looseEqual = looseEqual;
|
||||||
exports.looseIndexOf = looseIndexOf;
|
exports.looseIndexOf = looseIndexOf;
|
||||||
|
exports.looseToNumber = looseToNumber;
|
||||||
exports.makeMap = makeMap;
|
exports.makeMap = makeMap;
|
||||||
exports.normalizeClass = normalizeClass;
|
exports.normalizeClass = normalizeClass;
|
||||||
exports.normalizeProps = normalizeProps;
|
exports.normalizeProps = normalizeProps;
|
||||||
|
301
npm-packages/mac-v3.4.+/@vue/shared/dist/shared.d.ts
vendored
301
npm-packages/mac-v3.4.+/@vue/shared/dist/shared.d.ts
vendored
@ -1,137 +1,3 @@
|
|||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
export declare const camelize: (str: string) => string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
export declare const capitalize: (str: string) => string;
|
|
||||||
|
|
||||||
export declare const def: (obj: object, key: string | symbol, value: any) => void;
|
|
||||||
|
|
||||||
export declare const EMPTY_ARR: readonly never[];
|
|
||||||
|
|
||||||
export declare const EMPTY_OBJ: {
|
|
||||||
readonly [key: string]: any;
|
|
||||||
};
|
|
||||||
|
|
||||||
export declare function escapeHtml(string: unknown): string;
|
|
||||||
|
|
||||||
export declare function escapeHtmlComment(src: string): string;
|
|
||||||
|
|
||||||
export declare const extend: {
|
|
||||||
<T extends {}, U>(target: T, source: U): T & U;
|
|
||||||
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
|
||||||
<T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
|
||||||
(target: object, ...sources: any[]): any;
|
|
||||||
};
|
|
||||||
|
|
||||||
export declare function generateCodeFrame(source: string, start?: number, end?: number): string;
|
|
||||||
|
|
||||||
export declare function genPropsAccessExp(name: string): string;
|
|
||||||
|
|
||||||
export declare const getGlobalThis: () => any;
|
|
||||||
|
|
||||||
export declare const hasChanged: (value: any, oldValue: any) => boolean;
|
|
||||||
|
|
||||||
export declare const hasOwn: (val: object, key: string | symbol) => key is never;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
export declare const hyphenate: (str: string) => string;
|
|
||||||
|
|
||||||
export declare type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Boolean attributes should be included if the value is truthy or ''.
|
|
||||||
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
||||||
*/
|
|
||||||
export declare function includeBooleanAttr(value: unknown): boolean;
|
|
||||||
|
|
||||||
export declare const invokeArrayFns: (fns: Function[], arg?: any) => void;
|
|
||||||
|
|
||||||
export declare const isArray: (arg: any) => arg is any[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The full list is needed during SSR to produce the correct initial markup.
|
|
||||||
*/
|
|
||||||
export declare const isBooleanAttr: (key: string) => boolean;
|
|
||||||
|
|
||||||
export declare const isBuiltInDirective: (key: string) => boolean;
|
|
||||||
|
|
||||||
export declare const isDate: (val: unknown) => val is Date;
|
|
||||||
|
|
||||||
export declare const isFunction: (val: unknown) => val is Function;
|
|
||||||
|
|
||||||
export declare const isGloballyWhitelisted: (key: string) => boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compiler only.
|
|
||||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
||||||
*/
|
|
||||||
export declare const isHTMLTag: (key: string) => boolean;
|
|
||||||
|
|
||||||
export declare const isIntegerKey: (key: unknown) => boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Known attributes, this is used for stringification of runtime static nodes
|
|
||||||
* so that we don't stringify bindings that cannot be set from HTML.
|
|
||||||
* Don't also forget to allow `data-*` and `aria-*`!
|
|
||||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
|
||||||
*/
|
|
||||||
export declare const isKnownHtmlAttr: (key: string) => boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
|
||||||
*/
|
|
||||||
export declare const isKnownSvgAttr: (key: string) => boolean;
|
|
||||||
|
|
||||||
export declare const isMap: (val: unknown) => val is Map<any, any>;
|
|
||||||
|
|
||||||
export declare const isModelListener: (key: string) => boolean;
|
|
||||||
|
|
||||||
export declare const isObject: (val: unknown) => val is Record<any, any>;
|
|
||||||
|
|
||||||
export declare const isOn: (key: string) => boolean;
|
|
||||||
|
|
||||||
export declare const isPlainObject: (val: unknown) => val is object;
|
|
||||||
|
|
||||||
export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
|
|
||||||
|
|
||||||
export declare const isReservedProp: (key: string) => boolean;
|
|
||||||
|
|
||||||
export declare const isSet: (val: unknown) => val is Set<any>;
|
|
||||||
|
|
||||||
export declare const isSpecialBooleanAttr: (key: string) => boolean;
|
|
||||||
|
|
||||||
export declare function isSSRSafeAttrName(name: string): boolean;
|
|
||||||
|
|
||||||
export declare const isString: (val: unknown) => val is string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compiler only.
|
|
||||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
||||||
*/
|
|
||||||
export declare const isSVGTag: (key: string) => boolean;
|
|
||||||
|
|
||||||
export declare const isSymbol: (val: unknown) => val is symbol;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compiler only.
|
|
||||||
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
|
||||||
*/
|
|
||||||
export declare const isVoidTag: (key: string) => boolean;
|
|
||||||
|
|
||||||
export declare function looseEqual(a: any, b: any): boolean;
|
|
||||||
|
|
||||||
export declare function looseIndexOf(arr: any[], val: any): number;
|
|
||||||
|
|
||||||
export declare type LooseRequired<T> = {
|
|
||||||
[P in keyof (T & Required<T>)]: T[P];
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a map and return a function for checking if a key
|
* Make a map and return a function for checking if a key
|
||||||
* is in that map.
|
* is in that map.
|
||||||
@ -141,31 +7,73 @@ export declare type LooseRequired<T> = {
|
|||||||
*/
|
*/
|
||||||
export declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean;
|
export declare function makeMap(str: string, expectsLowerCase?: boolean): (key: string) => boolean;
|
||||||
|
|
||||||
|
export declare const EMPTY_OBJ: {
|
||||||
|
readonly [key: string]: any;
|
||||||
|
};
|
||||||
|
export declare const EMPTY_ARR: readonly never[];
|
||||||
|
export declare const NOOP: () => void;
|
||||||
/**
|
/**
|
||||||
* Always return false.
|
* Always return false.
|
||||||
*/
|
*/
|
||||||
export declare const NO: () => boolean;
|
export declare const NO: () => boolean;
|
||||||
|
export declare const isOn: (key: string) => boolean;
|
||||||
export declare const NOOP: () => void;
|
export declare const isModelListener: (key: string) => boolean;
|
||||||
|
export declare const extend: {
|
||||||
export declare function normalizeClass(value: unknown): string;
|
<T extends {}, U>(target: T, source: U): T & U;
|
||||||
|
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
||||||
export declare type NormalizedStyle = Record<string, string | number>;
|
<T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
||||||
|
(target: object, ...sources: any[]): any;
|
||||||
export declare function normalizeProps(props: Record<string, any> | null): Record<string, any> | null;
|
|
||||||
|
|
||||||
export declare function normalizeStyle(value: unknown): NormalizedStyle | string | undefined;
|
|
||||||
|
|
||||||
export declare const objectToString: () => string;
|
|
||||||
|
|
||||||
export declare function parseStringStyle(cssText: string): NormalizedStyle;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* dev only flag -> name mapping
|
|
||||||
*/
|
|
||||||
export declare const PatchFlagNames: {
|
|
||||||
[x: number]: string;
|
|
||||||
};
|
};
|
||||||
|
export declare const remove: <T>(arr: T[], el: T) => void;
|
||||||
|
export declare const hasOwn: (val: object, key: string | symbol) => key is never;
|
||||||
|
export declare const isArray: (arg: any) => arg is any[];
|
||||||
|
export declare const isMap: (val: unknown) => val is Map<any, any>;
|
||||||
|
export declare const isSet: (val: unknown) => val is Set<any>;
|
||||||
|
export declare const isDate: (val: unknown) => val is Date;
|
||||||
|
export declare const isRegExp: (val: unknown) => val is RegExp;
|
||||||
|
export declare const isFunction: (val: unknown) => val is Function;
|
||||||
|
export declare const isString: (val: unknown) => val is string;
|
||||||
|
export declare const isSymbol: (val: unknown) => val is symbol;
|
||||||
|
export declare const isObject: (val: unknown) => val is Record<any, any>;
|
||||||
|
export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
|
||||||
|
export declare const objectToString: () => string;
|
||||||
|
export declare const toTypeString: (value: unknown) => string;
|
||||||
|
export declare const toRawType: (value: unknown) => string;
|
||||||
|
export declare const isPlainObject: (val: unknown) => val is object;
|
||||||
|
export declare const isIntegerKey: (key: unknown) => boolean;
|
||||||
|
export declare const isReservedProp: (key: string) => boolean;
|
||||||
|
export declare const isBuiltInDirective: (key: string) => boolean;
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
export declare const camelize: (str: string) => string;
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
export declare const hyphenate: (str: string) => string;
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
export declare const capitalize: (str: string) => string;
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
export declare const toHandlerKey: (str: string) => string;
|
||||||
|
export declare const hasChanged: (value: any, oldValue: any) => boolean;
|
||||||
|
export declare const invokeArrayFns: (fns: Function[], arg?: any) => void;
|
||||||
|
export declare const def: (obj: object, key: string | symbol, value: any) => void;
|
||||||
|
/**
|
||||||
|
* "123-foo" will be parsed to 123
|
||||||
|
* This is used for the .number modifier in v-model
|
||||||
|
*/
|
||||||
|
export declare const looseToNumber: (val: any) => any;
|
||||||
|
/**
|
||||||
|
* Only conerces number-like strings
|
||||||
|
* "123-foo" will be returned as-is
|
||||||
|
*/
|
||||||
|
export declare const toNumber: (val: any) => any;
|
||||||
|
export declare const getGlobalThis: () => any;
|
||||||
|
export declare function genPropsAccessExp(name: string): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Patch flags are optimization hints generated by the compiler.
|
* Patch flags are optimization hints generated by the compiler.
|
||||||
@ -277,10 +185,10 @@ export declare const enum PatchFlags {
|
|||||||
*/
|
*/
|
||||||
BAIL = -2
|
BAIL = -2
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
export declare const propsToAttrMap: Record<string, string | undefined>;
|
* dev only flag -> name mapping
|
||||||
|
*/
|
||||||
export declare const remove: <T>(arr: T[], el: T) => void;
|
export declare const PatchFlagNames: Record<PatchFlags, string>;
|
||||||
|
|
||||||
export declare const enum ShapeFlags {
|
export declare const enum ShapeFlags {
|
||||||
ELEMENT = 1,
|
ELEMENT = 1,
|
||||||
@ -317,7 +225,6 @@ export declare const enum SlotFlags {
|
|||||||
*/
|
*/
|
||||||
FORWARDED = 3
|
FORWARDED = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dev only
|
* Dev only
|
||||||
*/
|
*/
|
||||||
@ -327,7 +234,62 @@ export declare const slotFlagsText: {
|
|||||||
3: string;
|
3: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export declare const isGloballyWhitelisted: (key: string) => boolean;
|
||||||
|
|
||||||
|
export declare function generateCodeFrame(source: string, start?: number, end?: number): string;
|
||||||
|
|
||||||
|
export type NormalizedStyle = Record<string, string | number>;
|
||||||
|
export declare function normalizeStyle(value: unknown): NormalizedStyle | string | undefined;
|
||||||
|
export declare function parseStringStyle(cssText: string): NormalizedStyle;
|
||||||
export declare function stringifyStyle(styles: NormalizedStyle | string | undefined): string;
|
export declare function stringifyStyle(styles: NormalizedStyle | string | undefined): string;
|
||||||
|
export declare function normalizeClass(value: unknown): string;
|
||||||
|
export declare function normalizeProps(props: Record<string, any> | null): Record<string, any> | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compiler only.
|
||||||
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||||
|
*/
|
||||||
|
export declare const isHTMLTag: (key: string) => boolean;
|
||||||
|
/**
|
||||||
|
* Compiler only.
|
||||||
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||||
|
*/
|
||||||
|
export declare const isSVGTag: (key: string) => boolean;
|
||||||
|
/**
|
||||||
|
* Compiler only.
|
||||||
|
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
|
||||||
|
*/
|
||||||
|
export declare const isVoidTag: (key: string) => boolean;
|
||||||
|
|
||||||
|
export declare const isSpecialBooleanAttr: (key: string) => boolean;
|
||||||
|
/**
|
||||||
|
* The full list is needed during SSR to produce the correct initial markup.
|
||||||
|
*/
|
||||||
|
export declare const isBooleanAttr: (key: string) => boolean;
|
||||||
|
/**
|
||||||
|
* Boolean attributes should be included if the value is truthy or ''.
|
||||||
|
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
||||||
|
*/
|
||||||
|
export declare function includeBooleanAttr(value: unknown): boolean;
|
||||||
|
export declare function isSSRSafeAttrName(name: string): boolean;
|
||||||
|
export declare const propsToAttrMap: Record<string, string | undefined>;
|
||||||
|
/**
|
||||||
|
* Known attributes, this is used for stringification of runtime static nodes
|
||||||
|
* so that we don't stringify bindings that cannot be set from HTML.
|
||||||
|
* Don't also forget to allow `data-*` and `aria-*`!
|
||||||
|
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
||||||
|
*/
|
||||||
|
export declare const isKnownHtmlAttr: (key: string) => boolean;
|
||||||
|
/**
|
||||||
|
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
||||||
|
*/
|
||||||
|
export declare const isKnownSvgAttr: (key: string) => boolean;
|
||||||
|
|
||||||
|
export declare function escapeHtml(string: unknown): string;
|
||||||
|
export declare function escapeHtmlComment(src: string): string;
|
||||||
|
|
||||||
|
export declare function looseEqual(a: any, b: any): boolean;
|
||||||
|
export declare function looseIndexOf(arr: any[], val: any): number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For converting {{ interpolation }} values to displayed strings.
|
* For converting {{ interpolation }} values to displayed strings.
|
||||||
@ -335,17 +297,12 @@ export declare function stringifyStyle(styles: NormalizedStyle | string | undefi
|
|||||||
*/
|
*/
|
||||||
export declare const toDisplayString: (val: unknown) => string;
|
export declare const toDisplayString: (val: unknown) => string;
|
||||||
|
|
||||||
/**
|
export type Prettify<T> = {
|
||||||
* @private
|
[K in keyof T]: T[K];
|
||||||
*/
|
} & {};
|
||||||
export declare const toHandlerKey: (str: string) => string;
|
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
||||||
|
export type LooseRequired<T> = {
|
||||||
|
[P in keyof (T & Required<T>)]: T[P];
|
||||||
|
};
|
||||||
|
export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
||||||
|
|
||||||
export declare const toNumber: (val: any) => any;
|
|
||||||
|
|
||||||
export declare const toRawType: (value: unknown) => string;
|
|
||||||
|
|
||||||
export declare const toTypeString: (value: unknown) => string;
|
|
||||||
|
|
||||||
export declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
||||||
|
|
||||||
export { }
|
|
||||||
|
@ -1,87 +1,162 @@
|
|||||||
/**
|
|
||||||
* Make a map and return a function for checking if a key
|
|
||||||
* is in that map.
|
|
||||||
* IMPORTANT: all calls of this function must be prefixed with
|
|
||||||
* \/\*#\_\_PURE\_\_\*\/
|
|
||||||
* So that rollup can tree-shake them if necessary.
|
|
||||||
*/
|
|
||||||
function makeMap(str, expectsLowerCase) {
|
function makeMap(str, expectsLowerCase) {
|
||||||
const map = Object.create(null);
|
const map = /* @__PURE__ */ Object.create(null);
|
||||||
const list = str.split(',');
|
const list = str.split(",");
|
||||||
for (let i = 0; i < list.length; i++) {
|
for (let i = 0; i < list.length; i++) {
|
||||||
map[list[i]] = true;
|
map[list[i]] = true;
|
||||||
}
|
}
|
||||||
return expectsLowerCase ? val => !!map[val.toLowerCase()] : val => !!map[val];
|
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
|
||||||
|
}
|
||||||
|
|
||||||
|
const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
|
||||||
|
const EMPTY_ARR = !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
|
||||||
|
const NOOP = () => {
|
||||||
|
};
|
||||||
|
const NO = () => false;
|
||||||
|
const onRE = /^on[^a-z]/;
|
||||||
|
const isOn = (key) => onRE.test(key);
|
||||||
|
const isModelListener = (key) => key.startsWith("onUpdate:");
|
||||||
|
const extend = Object.assign;
|
||||||
|
const remove = (arr, el) => {
|
||||||
|
const i = arr.indexOf(el);
|
||||||
|
if (i > -1) {
|
||||||
|
arr.splice(i, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||||
|
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
||||||
|
const isArray = Array.isArray;
|
||||||
|
const isMap = (val) => toTypeString(val) === "[object Map]";
|
||||||
|
const isSet = (val) => toTypeString(val) === "[object Set]";
|
||||||
|
const isDate = (val) => toTypeString(val) === "[object Date]";
|
||||||
|
const isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
||||||
|
const isFunction = (val) => typeof val === "function";
|
||||||
|
const isString = (val) => typeof val === "string";
|
||||||
|
const isSymbol = (val) => typeof val === "symbol";
|
||||||
|
const isObject = (val) => val !== null && typeof val === "object";
|
||||||
|
const isPromise = (val) => {
|
||||||
|
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
||||||
|
};
|
||||||
|
const objectToString = Object.prototype.toString;
|
||||||
|
const toTypeString = (value) => objectToString.call(value);
|
||||||
|
const toRawType = (value) => {
|
||||||
|
return toTypeString(value).slice(8, -1);
|
||||||
|
};
|
||||||
|
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
||||||
|
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
||||||
|
const isReservedProp = /* @__PURE__ */ makeMap(
|
||||||
|
// the leading comma is intentional so empty string "" is also included
|
||||||
|
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"
|
||||||
|
);
|
||||||
|
const isBuiltInDirective = /* @__PURE__ */ makeMap(
|
||||||
|
"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"
|
||||||
|
);
|
||||||
|
const cacheStringFunction = (fn) => {
|
||||||
|
const cache = /* @__PURE__ */ Object.create(null);
|
||||||
|
return (str) => {
|
||||||
|
const hit = cache[str];
|
||||||
|
return hit || (cache[str] = fn(str));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
const camelizeRE = /-(\w)/g;
|
||||||
|
const camelize = cacheStringFunction((str) => {
|
||||||
|
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
||||||
|
});
|
||||||
|
const hyphenateRE = /\B([A-Z])/g;
|
||||||
|
const hyphenate = cacheStringFunction(
|
||||||
|
(str) => str.replace(hyphenateRE, "-$1").toLowerCase()
|
||||||
|
);
|
||||||
|
const capitalize = cacheStringFunction(
|
||||||
|
(str) => str.charAt(0).toUpperCase() + str.slice(1)
|
||||||
|
);
|
||||||
|
const toHandlerKey = cacheStringFunction(
|
||||||
|
(str) => str ? `on${capitalize(str)}` : ``
|
||||||
|
);
|
||||||
|
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
||||||
|
const invokeArrayFns = (fns, arg) => {
|
||||||
|
for (let i = 0; i < fns.length; i++) {
|
||||||
|
fns[i](arg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const def = (obj, key, value) => {
|
||||||
|
Object.defineProperty(obj, key, {
|
||||||
|
configurable: true,
|
||||||
|
enumerable: false,
|
||||||
|
value
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const looseToNumber = (val) => {
|
||||||
|
const n = parseFloat(val);
|
||||||
|
return isNaN(n) ? val : n;
|
||||||
|
};
|
||||||
|
const toNumber = (val) => {
|
||||||
|
const n = isString(val) ? Number(val) : NaN;
|
||||||
|
return isNaN(n) ? val : n;
|
||||||
|
};
|
||||||
|
let _globalThis;
|
||||||
|
const getGlobalThis = () => {
|
||||||
|
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
||||||
|
};
|
||||||
|
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
||||||
|
function genPropsAccessExp(name) {
|
||||||
|
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* dev only flag -> name mapping
|
|
||||||
*/
|
|
||||||
const PatchFlagNames = {
|
const PatchFlagNames = {
|
||||||
[1 /* PatchFlags.TEXT */]: `TEXT`,
|
[1]: `TEXT`,
|
||||||
[2 /* PatchFlags.CLASS */]: `CLASS`,
|
[2]: `CLASS`,
|
||||||
[4 /* PatchFlags.STYLE */]: `STYLE`,
|
[4]: `STYLE`,
|
||||||
[8 /* PatchFlags.PROPS */]: `PROPS`,
|
[8]: `PROPS`,
|
||||||
[16 /* PatchFlags.FULL_PROPS */]: `FULL_PROPS`,
|
[16]: `FULL_PROPS`,
|
||||||
[32 /* PatchFlags.HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
|
[32]: `HYDRATE_EVENTS`,
|
||||||
[64 /* PatchFlags.STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
|
[64]: `STABLE_FRAGMENT`,
|
||||||
[128 /* PatchFlags.KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
|
[128]: `KEYED_FRAGMENT`,
|
||||||
[256 /* PatchFlags.UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
|
[256]: `UNKEYED_FRAGMENT`,
|
||||||
[512 /* PatchFlags.NEED_PATCH */]: `NEED_PATCH`,
|
[512]: `NEED_PATCH`,
|
||||||
[1024 /* PatchFlags.DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
|
[1024]: `DYNAMIC_SLOTS`,
|
||||||
[2048 /* PatchFlags.DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
|
[2048]: `DEV_ROOT_FRAGMENT`,
|
||||||
[-1 /* PatchFlags.HOISTED */]: `HOISTED`,
|
[-1]: `HOISTED`,
|
||||||
[-2 /* PatchFlags.BAIL */]: `BAIL`
|
[-2]: `BAIL`
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Dev only
|
|
||||||
*/
|
|
||||||
const slotFlagsText = {
|
const slotFlagsText = {
|
||||||
[1 /* SlotFlags.STABLE */]: 'STABLE',
|
[1]: "STABLE",
|
||||||
[2 /* SlotFlags.DYNAMIC */]: 'DYNAMIC',
|
[2]: "DYNAMIC",
|
||||||
[3 /* SlotFlags.FORWARDED */]: 'FORWARDED'
|
[3]: "FORWARDED"
|
||||||
};
|
};
|
||||||
|
|
||||||
const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
|
const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
|
||||||
'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
|
const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
|
||||||
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt';
|
|
||||||
const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED);
|
|
||||||
|
|
||||||
const range = 2;
|
const range = 2;
|
||||||
function generateCodeFrame(source, start = 0, end = source.length) {
|
function generateCodeFrame(source, start = 0, end = source.length) {
|
||||||
// Split the content into individual lines but capture the newline sequence
|
|
||||||
// that separated each line. This is important because the actual sequence is
|
|
||||||
// needed to properly take into account the full line length for offset
|
|
||||||
// comparison
|
|
||||||
let lines = source.split(/(\r?\n)/);
|
let lines = source.split(/(\r?\n)/);
|
||||||
// Separate the lines and newline sequences into separate arrays for easier referencing
|
|
||||||
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
||||||
lines = lines.filter((_, idx) => idx % 2 === 0);
|
lines = lines.filter((_, idx) => idx % 2 === 0);
|
||||||
let count = 0;
|
let count = 0;
|
||||||
const res = [];
|
const res = [];
|
||||||
for (let i = 0; i < lines.length; i++) {
|
for (let i = 0; i < lines.length; i++) {
|
||||||
count +=
|
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
|
||||||
lines[i].length +
|
|
||||||
((newlineSequences[i] && newlineSequences[i].length) || 0);
|
|
||||||
if (count >= start) {
|
if (count >= start) {
|
||||||
for (let j = i - range; j <= i + range || end > count; j++) {
|
for (let j = i - range; j <= i + range || end > count; j++) {
|
||||||
if (j < 0 || j >= lines.length)
|
if (j < 0 || j >= lines.length)
|
||||||
continue;
|
continue;
|
||||||
const line = j + 1;
|
const line = j + 1;
|
||||||
res.push(`${line}${' '.repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
|
res.push(
|
||||||
|
`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
|
||||||
|
);
|
||||||
const lineLength = lines[j].length;
|
const lineLength = lines[j].length;
|
||||||
const newLineSeqLength = (newlineSequences[j] && newlineSequences[j].length) || 0;
|
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
|
||||||
if (j === i) {
|
if (j === i) {
|
||||||
// push underline
|
|
||||||
const pad = start - (count - (lineLength + newLineSeqLength));
|
const pad = start - (count - (lineLength + newLineSeqLength));
|
||||||
const length = Math.max(1, end > count ? lineLength - pad : end - start);
|
const length = Math.max(
|
||||||
res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));
|
1,
|
||||||
}
|
end > count ? lineLength - pad : end - start
|
||||||
else if (j > i) {
|
);
|
||||||
|
res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
|
||||||
|
} else if (j > i) {
|
||||||
if (end > count) {
|
if (end > count) {
|
||||||
const length = Math.max(Math.min(end - count, lineLength), 1);
|
const length = Math.max(Math.min(end - count, lineLength), 1);
|
||||||
res.push(` | ` + '^'.repeat(length));
|
res.push(` | ` + "^".repeat(length));
|
||||||
}
|
}
|
||||||
count += lineLength + newLineSeqLength;
|
count += lineLength + newLineSeqLength;
|
||||||
}
|
}
|
||||||
@ -89,7 +164,7 @@ function generateCodeFrame(source, start = 0, end = source.length) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res.join('\n');
|
return res.join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeStyle(value) {
|
function normalizeStyle(value) {
|
||||||
@ -97,9 +172,7 @@ function normalizeStyle(value) {
|
|||||||
const res = {};
|
const res = {};
|
||||||
for (let i = 0; i < value.length; i++) {
|
for (let i = 0; i < value.length; i++) {
|
||||||
const item = value[i];
|
const item = value[i];
|
||||||
const normalized = isString(item)
|
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
||||||
? parseStringStyle(item)
|
|
||||||
: normalizeStyle(item);
|
|
||||||
if (normalized) {
|
if (normalized) {
|
||||||
for (const key in normalized) {
|
for (const key in normalized) {
|
||||||
res[key] = normalized[key];
|
res[key] = normalized[key];
|
||||||
@ -107,23 +180,18 @@ function normalizeStyle(value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
} else if (isString(value)) {
|
||||||
else if (isString(value)) {
|
|
||||||
return value;
|
return value;
|
||||||
}
|
} else if (isObject(value)) {
|
||||||
else if (isObject(value)) {
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const listDelimiterRE = /;(?![^(]*\))/g;
|
const listDelimiterRE = /;(?![^(]*\))/g;
|
||||||
const propertyDelimiterRE = /:([^]+)/;
|
const propertyDelimiterRE = /:([^]+)/;
|
||||||
const styleCommentRE = /\/\*.*?\*\//gs;
|
const styleCommentRE = /\/\*[^]*?\*\//g;
|
||||||
function parseStringStyle(cssText) {
|
function parseStringStyle(cssText) {
|
||||||
const ret = {};
|
const ret = {};
|
||||||
cssText
|
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
||||||
.replace(styleCommentRE, '')
|
|
||||||
.split(listDelimiterRE)
|
|
||||||
.forEach(item => {
|
|
||||||
if (item) {
|
if (item) {
|
||||||
const tmp = item.split(propertyDelimiterRE);
|
const tmp = item.split(propertyDelimiterRE);
|
||||||
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
||||||
@ -132,37 +200,34 @@ function parseStringStyle(cssText) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
function stringifyStyle(styles) {
|
function stringifyStyle(styles) {
|
||||||
let ret = '';
|
let ret = "";
|
||||||
if (!styles || isString(styles)) {
|
if (!styles || isString(styles)) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
for (const key in styles) {
|
for (const key in styles) {
|
||||||
const value = styles[key];
|
const value = styles[key];
|
||||||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
||||||
if (isString(value) || typeof value === 'number') {
|
if (isString(value) || typeof value === "number") {
|
||||||
// only render valid values
|
|
||||||
ret += `${normalizedKey}:${value};`;
|
ret += `${normalizedKey}:${value};`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
function normalizeClass(value) {
|
function normalizeClass(value) {
|
||||||
let res = '';
|
let res = "";
|
||||||
if (isString(value)) {
|
if (isString(value)) {
|
||||||
res = value;
|
res = value;
|
||||||
}
|
} else if (isArray(value)) {
|
||||||
else if (isArray(value)) {
|
|
||||||
for (let i = 0; i < value.length; i++) {
|
for (let i = 0; i < value.length; i++) {
|
||||||
const normalized = normalizeClass(value[i]);
|
const normalized = normalizeClass(value[i]);
|
||||||
if (normalized) {
|
if (normalized) {
|
||||||
res += normalized + ' ';
|
res += normalized + " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (isObject(value)) {
|
||||||
else if (isObject(value)) {
|
|
||||||
for (const name in value) {
|
for (const name in value) {
|
||||||
if (value[name]) {
|
if (value[name]) {
|
||||||
res += name + ' ';
|
res += name + " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,71 +246,20 @@ function normalizeProps(props) {
|
|||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
// These tag configs are shared between compiler-dom and runtime-dom, so they
|
const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
|
||||||
const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
|
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
|
||||||
'header,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
|
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
|
||||||
'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
|
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
|
||||||
'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +
|
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
|
||||||
'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
|
|
||||||
'canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,' +
|
|
||||||
'th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,' +
|
|
||||||
'option,output,progress,select,textarea,details,dialog,menu,' +
|
|
||||||
'summary,template,blockquote,iframe,tfoot';
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/SVG/Element
|
|
||||||
const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
|
|
||||||
'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
|
|
||||||
'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
|
|
||||||
'feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
|
|
||||||
'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
|
|
||||||
'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
|
|
||||||
'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
|
|
||||||
'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
|
|
||||||
'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
|
|
||||||
'text,textPath,title,tspan,unknown,use,view';
|
|
||||||
const VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
|
|
||||||
/**
|
|
||||||
* Compiler only.
|
|
||||||
* Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.
|
|
||||||
*/
|
|
||||||
const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
|
|
||||||
/**
|
|
||||||
* Compiler only.
|
|
||||||
* Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.
|
|
||||||
*/
|
|
||||||
const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
|
|
||||||
/**
|
|
||||||
* Compiler only.
|
|
||||||
* Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.
|
|
||||||
*/
|
|
||||||
const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On the client we only need to offer special cases for boolean attributes that
|
|
||||||
* have different names from their corresponding dom properties:
|
|
||||||
* - itemscope -> N/A
|
|
||||||
* - allowfullscreen -> allowFullscreen
|
|
||||||
* - formnovalidate -> formNoValidate
|
|
||||||
* - ismap -> isMap
|
|
||||||
* - nomodule -> noModule
|
|
||||||
* - novalidate -> noValidate
|
|
||||||
* - readonly -> readOnly
|
|
||||||
*/
|
|
||||||
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
||||||
const isSpecialBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs);
|
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
|
||||||
/**
|
const isBooleanAttr = /* @__PURE__ */ makeMap(
|
||||||
* The full list is needed during SSR to produce the correct initial markup.
|
specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`
|
||||||
*/
|
);
|
||||||
const isBooleanAttr = /*#__PURE__*/ makeMap(specialBooleanAttrs +
|
|
||||||
`,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +
|
|
||||||
`loop,open,required,reversed,scoped,seamless,` +
|
|
||||||
`checked,muted,multiple,selected`);
|
|
||||||
/**
|
|
||||||
* Boolean attributes should be included if the value is truthy or ''.
|
|
||||||
* e.g. `<select multiple>` compiles to `{ multiple: '' }`
|
|
||||||
*/
|
|
||||||
function includeBooleanAttr(value) {
|
function includeBooleanAttr(value) {
|
||||||
return !!value || value === '';
|
return !!value || value === "";
|
||||||
}
|
}
|
||||||
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
const unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
||||||
const attrValidationCache = {};
|
const attrValidationCache = {};
|
||||||
@ -257,105 +271,48 @@ function isSSRSafeAttrName(name) {
|
|||||||
if (isUnsafe) {
|
if (isUnsafe) {
|
||||||
console.error(`unsafe attribute name: ${name}`);
|
console.error(`unsafe attribute name: ${name}`);
|
||||||
}
|
}
|
||||||
return (attrValidationCache[name] = !isUnsafe);
|
return attrValidationCache[name] = !isUnsafe;
|
||||||
}
|
}
|
||||||
const propsToAttrMap = {
|
const propsToAttrMap = {
|
||||||
acceptCharset: 'accept-charset',
|
acceptCharset: "accept-charset",
|
||||||
className: 'class',
|
className: "class",
|
||||||
htmlFor: 'for',
|
htmlFor: "for",
|
||||||
httpEquiv: 'http-equiv'
|
httpEquiv: "http-equiv"
|
||||||
};
|
};
|
||||||
/**
|
const isKnownHtmlAttr = /* @__PURE__ */ makeMap(
|
||||||
* Known attributes, this is used for stringification of runtime static nodes
|
`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`
|
||||||
* so that we don't stringify bindings that cannot be set from HTML.
|
);
|
||||||
* Don't also forget to allow `data-*` and `aria-*`!
|
const isKnownSvgAttr = /* @__PURE__ */ makeMap(
|
||||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
|
`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`
|
||||||
*/
|
);
|
||||||
const isKnownHtmlAttr = /*#__PURE__*/ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,` +
|
|
||||||
`autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +
|
|
||||||
`border,buffered,capture,challenge,charset,checked,cite,class,code,` +
|
|
||||||
`codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,` +
|
|
||||||
`coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,` +
|
|
||||||
`disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,` +
|
|
||||||
`formaction,formenctype,formmethod,formnovalidate,formtarget,headers,` +
|
|
||||||
`height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,` +
|
|
||||||
`ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` +
|
|
||||||
`manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` +
|
|
||||||
`open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` +
|
|
||||||
`referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` +
|
|
||||||
`selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` +
|
|
||||||
`start,step,style,summary,tabindex,target,title,translate,type,usemap,` +
|
|
||||||
`value,width,wrap`);
|
|
||||||
/**
|
|
||||||
* Generated from https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
|
|
||||||
*/
|
|
||||||
const isKnownSvgAttr = /*#__PURE__*/ makeMap(`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,` +
|
|
||||||
`arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,` +
|
|
||||||
`baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,` +
|
|
||||||
`clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,` +
|
|
||||||
`color-interpolation-filters,color-profile,color-rendering,` +
|
|
||||||
`contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,` +
|
|
||||||
`descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,` +
|
|
||||||
`dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,` +
|
|
||||||
`fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,` +
|
|
||||||
`font-family,font-size,font-size-adjust,font-stretch,font-style,` +
|
|
||||||
`font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,` +
|
|
||||||
`glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,` +
|
|
||||||
`gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,` +
|
|
||||||
`horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,` +
|
|
||||||
`k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,` +
|
|
||||||
`lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,` +
|
|
||||||
`marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,` +
|
|
||||||
`mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,` +
|
|
||||||
`name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,` +
|
|
||||||
`overflow,overline-position,overline-thickness,panose-1,paint-order,path,` +
|
|
||||||
`pathLength,patternContentUnits,patternTransform,patternUnits,ping,` +
|
|
||||||
`pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,` +
|
|
||||||
`preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,` +
|
|
||||||
`rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,` +
|
|
||||||
`restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,` +
|
|
||||||
`specularConstant,specularExponent,speed,spreadMethod,startOffset,` +
|
|
||||||
`stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,` +
|
|
||||||
`strikethrough-position,strikethrough-thickness,string,stroke,` +
|
|
||||||
`stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,` +
|
|
||||||
`stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,` +
|
|
||||||
`systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,` +
|
|
||||||
`text-decoration,text-rendering,textLength,to,transform,transform-origin,` +
|
|
||||||
`type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,` +
|
|
||||||
`unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,` +
|
|
||||||
`v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,` +
|
|
||||||
`vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,` +
|
|
||||||
`writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,` +
|
|
||||||
`xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,` +
|
|
||||||
`xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`);
|
|
||||||
|
|
||||||
const escapeRE = /["'&<>]/;
|
const escapeRE = /["'&<>]/;
|
||||||
function escapeHtml(string) {
|
function escapeHtml(string) {
|
||||||
const str = '' + string;
|
const str = "" + string;
|
||||||
const match = escapeRE.exec(str);
|
const match = escapeRE.exec(str);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
let html = '';
|
let html = "";
|
||||||
let escaped;
|
let escaped;
|
||||||
let index;
|
let index;
|
||||||
let lastIndex = 0;
|
let lastIndex = 0;
|
||||||
for (index = match.index; index < str.length; index++) {
|
for (index = match.index; index < str.length; index++) {
|
||||||
switch (str.charCodeAt(index)) {
|
switch (str.charCodeAt(index)) {
|
||||||
case 34: // "
|
case 34:
|
||||||
escaped = '"';
|
escaped = """;
|
||||||
break;
|
break;
|
||||||
case 38: // &
|
case 38:
|
||||||
escaped = '&';
|
escaped = "&";
|
||||||
break;
|
break;
|
||||||
case 39: // '
|
case 39:
|
||||||
escaped = ''';
|
escaped = "'";
|
||||||
break;
|
break;
|
||||||
case 60: // <
|
case 60:
|
||||||
escaped = '<';
|
escaped = "<";
|
||||||
break;
|
break;
|
||||||
case 62: // >
|
case 62:
|
||||||
escaped = '>';
|
escaped = ">";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
@ -368,10 +325,9 @@ function escapeHtml(string) {
|
|||||||
}
|
}
|
||||||
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
||||||
}
|
}
|
||||||
// https://www.w3.org/TR/html52/syntax.html#comments
|
|
||||||
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
const commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
||||||
function escapeHtmlComment(src) {
|
function escapeHtmlComment(src) {
|
||||||
return src.replace(commentStripRE, '');
|
return src.replace(commentStripRE, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
function looseCompareArrays(a, b) {
|
function looseCompareArrays(a, b) {
|
||||||
@ -404,7 +360,6 @@ function looseEqual(a, b) {
|
|||||||
aValidType = isObject(a);
|
aValidType = isObject(a);
|
||||||
bValidType = isObject(b);
|
bValidType = isObject(b);
|
||||||
if (aValidType || bValidType) {
|
if (aValidType || bValidType) {
|
||||||
/* istanbul ignore if: this if will probably never be called */
|
|
||||||
if (!aValidType || !bValidType) {
|
if (!aValidType || !bValidType) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -416,9 +371,7 @@ function looseEqual(a, b) {
|
|||||||
for (const key in a) {
|
for (const key in a) {
|
||||||
const aHasKey = a.hasOwnProperty(key);
|
const aHasKey = a.hasOwnProperty(key);
|
||||||
const bHasKey = b.hasOwnProperty(key);
|
const bHasKey = b.hasOwnProperty(key);
|
||||||
if ((aHasKey && !bHasKey) ||
|
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
|
||||||
(!aHasKey && bHasKey) ||
|
|
||||||
!looseEqual(a[key], b[key])) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -426,162 +379,30 @@ function looseEqual(a, b) {
|
|||||||
return String(a) === String(b);
|
return String(a) === String(b);
|
||||||
}
|
}
|
||||||
function looseIndexOf(arr, val) {
|
function looseIndexOf(arr, val) {
|
||||||
return arr.findIndex(item => looseEqual(item, val));
|
return arr.findIndex((item) => looseEqual(item, val));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* For converting {{ interpolation }} values to displayed strings.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
const toDisplayString = (val) => {
|
const toDisplayString = (val) => {
|
||||||
return isString(val)
|
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);
|
||||||
? val
|
|
||||||
: val == null
|
|
||||||
? ''
|
|
||||||
: isArray(val) ||
|
|
||||||
(isObject(val) &&
|
|
||||||
(val.toString === objectToString || !isFunction(val.toString)))
|
|
||||||
? JSON.stringify(val, replacer, 2)
|
|
||||||
: String(val);
|
|
||||||
};
|
};
|
||||||
const replacer = (_key, val) => {
|
const replacer = (_key, val) => {
|
||||||
// can't use isRef here since @vue/shared has no deps
|
|
||||||
if (val && val.__v_isRef) {
|
if (val && val.__v_isRef) {
|
||||||
return replacer(_key, val.value);
|
return replacer(_key, val.value);
|
||||||
}
|
} else if (isMap(val)) {
|
||||||
else if (isMap(val)) {
|
|
||||||
return {
|
return {
|
||||||
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {
|
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
|
||||||
entries[`${key} =>`] = val;
|
entries[`${key} =>`] = val2;
|
||||||
return entries;
|
return entries;
|
||||||
}, {})
|
}, {})
|
||||||
};
|
};
|
||||||
}
|
} else if (isSet(val)) {
|
||||||
else if (isSet(val)) {
|
|
||||||
return {
|
return {
|
||||||
[`Set(${val.size})`]: [...val.values()]
|
[`Set(${val.size})`]: [...val.values()]
|
||||||
};
|
};
|
||||||
}
|
} else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
||||||
else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
|
|
||||||
return String(val);
|
return String(val);
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
};
|
};
|
||||||
|
|
||||||
const EMPTY_OBJ = (process.env.NODE_ENV !== 'production')
|
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isModelListener, isObject, isOn, isPlainObject, isPromise, isRegExp, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
|
||||||
? Object.freeze({})
|
|
||||||
: {};
|
|
||||||
const EMPTY_ARR = (process.env.NODE_ENV !== 'production') ? Object.freeze([]) : [];
|
|
||||||
const NOOP = () => { };
|
|
||||||
/**
|
|
||||||
* Always return false.
|
|
||||||
*/
|
|
||||||
const NO = () => false;
|
|
||||||
const onRE = /^on[^a-z]/;
|
|
||||||
const isOn = (key) => onRE.test(key);
|
|
||||||
const isModelListener = (key) => key.startsWith('onUpdate:');
|
|
||||||
const extend = Object.assign;
|
|
||||||
const remove = (arr, el) => {
|
|
||||||
const i = arr.indexOf(el);
|
|
||||||
if (i > -1) {
|
|
||||||
arr.splice(i, 1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
||||||
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
||||||
const isArray = Array.isArray;
|
|
||||||
const isMap = (val) => toTypeString(val) === '[object Map]';
|
|
||||||
const isSet = (val) => toTypeString(val) === '[object Set]';
|
|
||||||
const isDate = (val) => toTypeString(val) === '[object Date]';
|
|
||||||
const isFunction = (val) => typeof val === 'function';
|
|
||||||
const isString = (val) => typeof val === 'string';
|
|
||||||
const isSymbol = (val) => typeof val === 'symbol';
|
|
||||||
const isObject = (val) => val !== null && typeof val === 'object';
|
|
||||||
const isPromise = (val) => {
|
|
||||||
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
||||||
};
|
|
||||||
const objectToString = Object.prototype.toString;
|
|
||||||
const toTypeString = (value) => objectToString.call(value);
|
|
||||||
const toRawType = (value) => {
|
|
||||||
// extract "RawType" from strings like "[object RawType]"
|
|
||||||
return toTypeString(value).slice(8, -1);
|
|
||||||
};
|
|
||||||
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
|
|
||||||
const isIntegerKey = (key) => isString(key) &&
|
|
||||||
key !== 'NaN' &&
|
|
||||||
key[0] !== '-' &&
|
|
||||||
'' + parseInt(key, 10) === key;
|
|
||||||
const isReservedProp = /*#__PURE__*/ makeMap(
|
|
||||||
// the leading comma is intentional so empty string "" is also included
|
|
||||||
',key,ref,ref_for,ref_key,' +
|
|
||||||
'onVnodeBeforeMount,onVnodeMounted,' +
|
|
||||||
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
|
||||||
'onVnodeBeforeUnmount,onVnodeUnmounted');
|
|
||||||
const isBuiltInDirective = /*#__PURE__*/ makeMap('bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo');
|
|
||||||
const cacheStringFunction = (fn) => {
|
|
||||||
const cache = Object.create(null);
|
|
||||||
return ((str) => {
|
|
||||||
const hit = cache[str];
|
|
||||||
return hit || (cache[str] = fn(str));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const camelizeRE = /-(\w)/g;
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
const camelize = cacheStringFunction((str) => {
|
|
||||||
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
|
|
||||||
});
|
|
||||||
const hyphenateRE = /\B([A-Z])/g;
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, '-$1').toLowerCase());
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
const toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
|
|
||||||
// compare whether a value has changed, accounting for NaN.
|
|
||||||
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
||||||
const invokeArrayFns = (fns, arg) => {
|
|
||||||
for (let i = 0; i < fns.length; i++) {
|
|
||||||
fns[i](arg);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const def = (obj, key, value) => {
|
|
||||||
Object.defineProperty(obj, key, {
|
|
||||||
configurable: true,
|
|
||||||
enumerable: false,
|
|
||||||
value
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const toNumber = (val) => {
|
|
||||||
const n = parseFloat(val);
|
|
||||||
return isNaN(n) ? val : n;
|
|
||||||
};
|
|
||||||
let _globalThis;
|
|
||||||
const getGlobalThis = () => {
|
|
||||||
return (_globalThis ||
|
|
||||||
(_globalThis =
|
|
||||||
typeof globalThis !== 'undefined'
|
|
||||||
? globalThis
|
|
||||||
: typeof self !== 'undefined'
|
|
||||||
? self
|
|
||||||
: typeof window !== 'undefined'
|
|
||||||
? window
|
|
||||||
: typeof global !== 'undefined'
|
|
||||||
? global
|
|
||||||
: {}));
|
|
||||||
};
|
|
||||||
const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
|
||||||
function genPropsAccessExp(name) {
|
|
||||||
return identRE.test(name)
|
|
||||||
? `__props.${name}`
|
|
||||||
: `__props[${JSON.stringify(name)}]`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isModelListener, isObject, isOn, isPlainObject, isPromise, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vue/shared",
|
"name": "@vue/shared",
|
||||||
"version": "3.2.45",
|
"version": "3.3.4",
|
||||||
"description": "internal utils shared across @vue packages",
|
"description": "internal utils shared across @vue packages",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"module": "dist/shared.esm-bundler.js",
|
"module": "dist/shared.esm-bundler.js",
|
||||||
|
@ -1,5 +1,18 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v15.3.0
|
||||||
|
- Added support for smart layer puppet filter (`placedLayer.filter`)
|
||||||
|
|
||||||
|
## v15.2.0
|
||||||
|
- Added handling missing `font` in text layer style by assuming first font on the list
|
||||||
|
|
||||||
|
## v15.1.0
|
||||||
|
- Added support for float color in effects, new color type was added
|
||||||
|
```ts
|
||||||
|
export type FRGB = { fr: number; fg: number; fb: number; }; // values from 0 to 1 (can be above 1)
|
||||||
|
```
|
||||||
|
- Changed `time` field on `LinkedFile` from `Date` to `string` type
|
||||||
|
|
||||||
## v15.0.0
|
## v15.0.0
|
||||||
- Added support for frame and timeline animations
|
- Added support for frame and timeline animations
|
||||||
|
|
||||||
|
@ -686,11 +686,12 @@ Many fields in PSD file support passing color in different color formats (RGBA,
|
|||||||
```ts
|
```ts
|
||||||
type RGBA = { r: number; g: number; b: number; a: number; }; // values from 0 to 255
|
type RGBA = { r: number; g: number; b: number; a: number; }; // values from 0 to 255
|
||||||
type RGB = { r: number; g: number; b: number; }; // values from 0 to 255
|
type RGB = { r: number; g: number; b: number; }; // values from 0 to 255
|
||||||
|
type FRGB = { fr: number; fg: number; fb: number; }; // values from 0 to 1 (can be above 1)
|
||||||
type HSB = { h: number; s: number; b: number; }; // values from 0 to 1
|
type HSB = { h: number; s: number; b: number; }; // values from 0 to 1
|
||||||
type CMYK = { c: number; m: number; y: number; k: number; }; // values from 0 to 255
|
type CMYK = { c: number; m: number; y: number; k: number; }; // values from 0 to 255
|
||||||
type LAB = { l: number; a: number; b: number; }; // values `l` from 0 to 1; `a` and `b` from -1 to 1
|
type LAB = { l: number; a: number; b: number; }; // values `l` from 0 to 1; `a` and `b` from -1 to 1
|
||||||
type Grayscale = { k: number }; // values from 0 to 255
|
type Grayscale = { k: number }; // values from 0 to 255
|
||||||
type Color = RGBA | RGB | HSB | CMYK | LAB | Grayscale;
|
type Color = RGBA | RGB | FRGB | HSB | CMYK | LAB | Grayscale;
|
||||||
```
|
```
|
||||||
|
|
||||||
When you want to set field with a `Color` type, it's pretty straightforward, you can just choose any of the formats you like and set it on the field:
|
When you want to set field with a `Color` type, it's pretty straightforward, you can just choose any of the formats you like and set it on the field:
|
||||||
@ -712,6 +713,8 @@ if ('l' in color) {
|
|||||||
// color is Grayscale
|
// color is Grayscale
|
||||||
} else if ('a' in color) {
|
} else if ('a' in color) {
|
||||||
// color is RGBA
|
// color is RGBA
|
||||||
|
} else if ('rf' in color) {
|
||||||
|
// color is FRGB
|
||||||
} else {
|
} else {
|
||||||
// color is RGB
|
// color is RGB
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
- remove gulp
|
|
||||||
|
|
||||||
- can we remove sectionDivider property ?
|
- can we remove sectionDivider property ?
|
||||||
- can we remove nameSource property ?
|
- can we remove nameSource property ?
|
||||||
|
|
||||||
|
3
npm-packages/mac-v3.4.+/ag-psd/clean.js
Normal file
3
npm-packages/mac-v3.4.+/ag-psd/clean.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
fs.rmSync('dist', { recursive: true, force: true });
|
||||||
|
fs.rmSync('dist-es', { recursive: true, force: true });
|
File diff suppressed because one or more lines are too long
1
npm-packages/mac-v3.4.+/ag-psd/dist-es/abr.js.map
Normal file
1
npm-packages/mac-v3.4.+/ag-psd/dist-es/abr.js.map
Normal file
File diff suppressed because one or more lines are too long
@ -5,9 +5,9 @@ export interface ExtendedWriteOptions extends WriteOptions {
|
|||||||
layerIds: Set<number>;
|
layerIds: Set<number>;
|
||||||
layerToId: Map<any, number>;
|
layerToId: Map<any, number>;
|
||||||
}
|
}
|
||||||
declare type HasMethod = (target: LayerAdditionalInfo) => boolean;
|
type HasMethod = (target: LayerAdditionalInfo) => boolean;
|
||||||
declare type ReadMethod = (reader: PsdReader, target: LayerAdditionalInfo, left: () => number, psd: Psd, options: ReadOptions) => void;
|
type ReadMethod = (reader: PsdReader, target: LayerAdditionalInfo, left: () => number, psd: Psd, options: ReadOptions) => void;
|
||||||
declare type WriteMethod = (writer: PsdWriter, target: LayerAdditionalInfo, psd: Psd, options: ExtendedWriteOptions) => void;
|
type WriteMethod = (writer: PsdWriter, target: LayerAdditionalInfo, psd: Psd, options: ExtendedWriteOptions) => void;
|
||||||
export interface InfoHandler {
|
export interface InfoHandler {
|
||||||
key: string;
|
key: string;
|
||||||
has: HasMethod;
|
has: HasMethod;
|
||||||
|
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user