penambahan web socket

This commit is contained in:
2025-09-18 19:01:22 +07:00
parent 1d053646a9
commit d7bb2eb5bb
15070 changed files with 2402916 additions and 0 deletions

No files matched your search

@@ -0,0 +1,22 @@
Copyright (c) Ben Briggs <[email protected]> (http://beneb.info)
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,46 @@
# [postcss][postcss]-unique-selectors
> Ensure CSS selectors are unique.
## Install
With [npm](https://npmjs.org/package/postcss-unique-selectors) do:
```
npm install postcss-unique-selectors --save
```
## Example
Selectors are sorted naturally, and deduplicated:
### Input
```css
h1,h3,h2,h1 {
color: red
}
```
### Output
```css
h1,h2,h3 {
color: red
}
```
## Usage
See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
examples for your environment.
## Contributors
See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).
## License
MIT © [Ben Briggs](http://beneb.info)
[postcss]: https://github.com/postcss/postcss
@@ -0,0 +1,40 @@
{
"name": "postcss-unique-selectors",
"version": "7.0.4",
"description": "Ensure CSS selectors are unique.",
"main": "src/index.js",
"types": "types/index.d.ts",
"files": [
"LICENSE-MIT",
"src",
"types"
],
"keywords": [
"css",
"postcss",
"postcss-plugin"
],
"license": "MIT",
"homepage": "https://github.com/cssnano/cssnano",
"author": {
"name": "Ben Briggs",
"email": "[email protected]",
"url": "http://beneb.info"
},
"repository": "cssnano/cssnano",
"dependencies": {
"postcss-selector-parser": "^7.1.0"
},
"bugs": {
"url": "https://github.com/cssnano/cssnano/issues"
},
"engines": {
"node": "^18.12.0 || ^20.9.0 || >=22.0"
},
"devDependencies": {
"postcss": "^8.5.3"
},
"peerDependencies": {
"postcss": "^8.4.32"
}
}
@@ -0,0 +1,67 @@
'use strict';
const selectorParser = require('postcss-selector-parser');
/**
* @param {string} selectors
* @return {string}
*/
function generateUniqueSelector(selectors) {
/** @type {Map<string, string>} */
const uniqueSelectors = new Map();
/** @type {selectorParser.SyncProcessor<void>} */
const collectUniqueSelectors = (selNode) => {
for (const node of selNode.nodes) {
/** @type {string[]} */
const comments = [];
// Duplicates are removed by stripping the comments and using the results as the Map key.
const keyNode = node.clone();
keyNode.walk((sel) => {
if (sel.type === 'comment') {
comments.push(sel.value);
sel.remove();
}
});
const key = keyNode.toString().trim();
const dupeSelector = uniqueSelectors.get(key);
if (!dupeSelector) {
uniqueSelectors.set(key, node.toString());
} else if (comments.length) {
// If the duplicate selector has a comment, it is concatenated to the end of the selector.
uniqueSelectors.set(key, `${dupeSelector}${comments.join('')}`);
}
}
};
selectorParser(collectUniqueSelectors).processSync(selectors);
return [...uniqueSelectors.entries()]
.sort(([a], [b]) => (a > b ? 1 : a < b ? -1 : 0))
.map(([, selector]) => selector)
.join();
}
/**
* @type {import('postcss').PluginCreator<void>}
* @return {import('postcss').Plugin}
*/
function pluginCreator() {
return {
postcssPlugin: 'postcss-unique-selectors',
OnceExit(css) {
css.walkRules((nodes) => {
if (nodes.raws.selector && nodes.raws.selector.raw) {
nodes.raws.selector.raw = generateUniqueSelector(
nodes.raws.selector.raw
);
} else {
nodes.selector = generateUniqueSelector(nodes.selector);
}
});
},
};
}
pluginCreator.postcss = true;
module.exports = pluginCreator;
@@ -0,0 +1,10 @@
export = pluginCreator;
/**
* @type {import('postcss').PluginCreator<void>}
* @return {import('postcss').Plugin}
*/
declare function pluginCreator(): import("postcss").Plugin;
declare namespace pluginCreator {
let postcss: true;
}
//# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AA4CA;;;GAGG;AACH,kCAFY,OAAO,SAAS,EAAE,MAAM,CAiBnC"}