{"_id":"vite-plugin-dynamic-publicpath","_rev":"2764567","name":"vite-plugin-dynamic-publicpath","description":"A vite plugin for dynamic publicpath, like __webpack_public_path__","dist-tags":{"latest":"1.1.2"},"maintainers":[{"name":"pure-jy","email":"purejy@163.com"}],"time":{"modified":"2022-03-28T10:23:44.000Z","created":"2021-07-05T16:36:14.387Z","1.1.2":"2022-02-26T02:04:33.748Z","1.1.1":"2022-01-15T11:11:27.458Z","1.1.0":"2021-11-05T16:24:41.000Z","1.0.2":"2021-07-09T04:55:52.257Z","1.0.1":"2021-07-08T16:50:04.800Z","1.0.0":"2021-07-05T16:36:14.387Z"},"users":{},"author":{"name":"Jy"},"repository":{"type":"git","url":"git+https://github.com/jy0529/vite-plugin-dynamic-publicpath.git"},"versions":{"1.1.2":{"name":"vite-plugin-dynamic-publicpath","version":"1.1.2","description":"A vite plugin for dynamic publicpath, like __webpack_public_path__","main":"dist/index.js","scripts":{"dev":"tsc -p . -w --incremental --skipLibCheck","build":"rm -rf dist && tsc -p . --skipLibCheck","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0","prepublishOnly":"yarn build"},"repository":{"type":"git","url":"git+https://github.com/jy0529/vite-plugin-dynamic-publicpath.git"},"keywords":["vite","publicpath","dynamic publicpath"],"author":{"name":"Jy"},"license":"MIT","bugs":{"url":"https://github.com/jy0529/vite-plugin-dynamic-publicpath/issues"},"homepage":"https://github.com/jy0529/vite-plugin-dynamic-publicpath#readme","dependencies":{"es-module-lexer":"^0.6.0"},"devDependencies":{"@types/node":"^16.0.0","vite":"^2.4.0"},"gitHead":"6a6fa219b420cb9b64ee69fa9fd38bce946d2c6f","_id":"vite-plugin-dynamic-publicpath@1.1.2","_nodeVersion":"14.19.0","_npmVersion":"6.14.16","dist":{"shasum":"bef4ccf56d500b9414653a92cd5783f152a5fd9e","size":4871,"noattachment":false,"key":"/vite-plugin-dynamic-publicpath/-/vite-plugin-dynamic-publicpath-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/vite-plugin-dynamic-publicpath/download/vite-plugin-dynamic-publicpath-1.1.2.tgz"},"_npmUser":{"name":"pure-jy","email":"purejy@163.com"},"directories":{},"maintainers":[{"name":"pure-jy","email":"purejy@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-dynamic-publicpath_1.1.2_1645841073614_0.713561359523712"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-02-26T02:04:39.334Z","publish_time":1645841073748,"_cnpm_publish_time":1645841073748},"1.1.1":{"name":"vite-plugin-dynamic-publicpath","version":"1.1.1","description":"A vite plugin for dynamic publicpath, like __webpack_public_path__","main":"dist/index.js","scripts":{"dev":"tsc -p . -w --incremental --skipLibCheck","build":"rm -rf dist && tsc -p . --skipLibCheck","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0","prepublishOnly":"yarn build"},"repository":{"type":"git","url":"git+https://github.com/jy0529/vite-plugin-dynamic-publicpath.git"},"keywords":["vite","publicpath","dynamic publicpath"],"author":{"name":"Jy"},"license":"MIT","bugs":{"url":"https://github.com/jy0529/vite-plugin-dynamic-publicpath/issues"},"homepage":"https://github.com/jy0529/vite-plugin-dynamic-publicpath#readme","dependencies":{"es-module-lexer":"^0.6.0"},"devDependencies":{"@types/node":"^16.0.0","vite":"^2.4.0"},"licenseText":"MIT License\n\nCopyright (c) 2021 Jy\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"vite-plugin-dynamic-publicpath@1.1.1","dist":{"shasum":"050b4125c34db8c0800cef7eb6c5ae22e0de23c5","size":4780,"noattachment":false,"key":"/vite-plugin-dynamic-publicpath/-/vite-plugin-dynamic-publicpath-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/vite-plugin-dynamic-publicpath/download/vite-plugin-dynamic-publicpath-1.1.1.tgz"},"_npmUser":{"name":"pure-jy","email":"purejy@163.com"},"directories":{},"maintainers":[{"name":"pure-jy","email":"purejy@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-dynamic-publicpath_1.1.1_1642245087269_0.3635279434695331"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-01-15T11:11:33.409Z","publish_time":1642245087458,"_cnpm_publish_time":1642245087458},"1.1.0":{"name":"vite-plugin-dynamic-publicpath","version":"1.1.0","description":"A vite plugin for dynamic publicpath, like __webpack_public_path__","main":"dist/index.js","scripts":{"dev":"tsc -p . -w --incremental --skipLibCheck","build":"rm -rf dist && tsc -p . --skipLibCheck","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0","prepublishOnly":"yarn build"},"repository":{"type":"git","url":"git+https://github.com/jy0529/vite-plugin-dynamic-publicpath.git"},"keywords":["vite","publicpath","dynamic publicpath"],"author":{"name":"Jy"},"license":"MIT","bugs":{"url":"https://github.com/jy0529/vite-plugin-dynamic-publicpath/issues"},"homepage":"https://github.com/jy0529/vite-plugin-dynamic-publicpath#readme","devDependencies":{"@types/node":"^16.0.0","es-module-lexer":"^0.6.0","vite":"^2.4.0"},"gitHead":"46f569d005fb6d79589c3b419599d80afe48909b","_id":"vite-plugin-dynamic-publicpath@1.1.0","_nodeVersion":"14.17.0","_npmVersion":"6.14.13","dist":{"shasum":"68473a46a64e36db03be871068a247de746e1f02","size":4708,"noattachment":false,"key":"/vite-plugin-dynamic-publicpath/-/vite-plugin-dynamic-publicpath-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/vite-plugin-dynamic-publicpath/download/vite-plugin-dynamic-publicpath-1.1.0.tgz"},"_npmUser":{"name":"pure-jy","email":"purejy@163.com"},"directories":{},"maintainers":[{"name":"pure-jy","email":"purejy@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-dynamic-publicpath_1.1.0_1636129480797_0.8273868260239499"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-27T17:54:21.890Z","publish_time":1636129481000,"_cnpm_publish_time":1636129481000},"1.0.2":{"name":"vite-plugin-dynamic-publicpath","version":"1.0.2","description":"A vite plugin for dynamic publicpath, like __webpack_public_path__","main":"dist/index.js","scripts":{"dev":"tsc -p . -w --incremental --skipLibCheck","build":"rm -rf dist && tsc -p . --skipLibCheck","prepublishOnly":"yarn build"},"repository":{"type":"git","url":"git+https://github.com/jy0529/vite-plugin-dynamic-publicpath.git"},"keywords":["vite","publicpath","dynamic publicpath"],"author":{"name":"Jy"},"license":"MIT","bugs":{"url":"https://github.com/jy0529/vite-plugin-dynamic-publicpath/issues"},"homepage":"https://github.com/jy0529/vite-plugin-dynamic-publicpath#readme","devDependencies":{"@types/node":"^16.0.0","es-module-lexer":"^0.6.0","vite":"^2.4.0"},"licenseText":"MIT License\n\nCopyright (c) 2021 Jy\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"vite-plugin-dynamic-publicpath@1.0.2","dist":{"shasum":"c2c98c2fe2e2ba5af13d1963d5455b5cfc991792","size":3829,"noattachment":false,"key":"/vite-plugin-dynamic-publicpath/-/vite-plugin-dynamic-publicpath-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/vite-plugin-dynamic-publicpath/download/vite-plugin-dynamic-publicpath-1.0.2.tgz"},"_npmUser":{"name":"pure-jy","email":"purejy@163.com"},"directories":{},"maintainers":[{"name":"pure-jy","email":"purejy@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-dynamic-publicpath_1.0.2_1625806552138_0.12476298614398651"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-27T17:54:20.954Z","publish_time":1625806552257,"_cnpm_publish_time":1625806552257},"1.0.1":{"name":"vite-plugin-dynamic-publicpath","version":"1.0.1","description":"A vite plugin for dynamic publicpath, like __webpack_public_path__","main":"dist/index.js","scripts":{"dev":"tsc -p . -w --incremental --skipLibCheck","build":"rm -rf dist && tsc -p . --skipLibCheck","prepublishOnly":"yarn build"},"repository":{"type":"git","url":"git+https://github.com/jy0529/vite-plugin-dynamic-publicpath.git"},"keywords":["vite","publicpath","dynamic publicpath"],"author":{"name":"Jy"},"license":"MIT","bugs":{"url":"https://github.com/jy0529/vite-plugin-dynamic-publicpath/issues"},"homepage":"https://github.com/jy0529/vite-plugin-dynamic-publicpath#readme","devDependencies":{"@types/node":"^16.0.0","es-module-lexer":"^0.6.0","vite":"^2.4.0"},"licenseText":"MIT License\n\nCopyright (c) 2021 Jy\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"vite-plugin-dynamic-publicpath@1.0.1","dist":{"shasum":"d6179245f04e1241f43ae8c225bee549b488cf1a","size":3824,"noattachment":false,"key":"/vite-plugin-dynamic-publicpath/-/vite-plugin-dynamic-publicpath-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/vite-plugin-dynamic-publicpath/download/vite-plugin-dynamic-publicpath-1.0.1.tgz"},"_npmUser":{"name":"pure-jy","email":"purejy@163.com"},"directories":{},"maintainers":[{"name":"pure-jy","email":"purejy@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-dynamic-publicpath_1.0.1_1625763004658_0.702466581015565"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-27T17:54:19.994Z","publish_time":1625763004800,"_cnpm_publish_time":1625763004800},"1.0.0":{"name":"vite-plugin-dynamic-publicpath","version":"1.0.0","description":"A vite plugin for dynamic publicpath, like __webpack_public_path__","main":"dist/index.js","scripts":{"dev":"tsc -p . -w --incremental --skipLibCheck","build":"rm -rf dist && tsc -p . --skipLibCheck","prepublishOnly":"yarn build"},"repository":{"type":"git","url":"git+https://github.com/jy0529/vite-plugin-dynamic-publicpath.git"},"keywords":["vite","publicpath","dynamic publicpath"],"author":{"name":"Jy"},"license":"MIT","bugs":{"url":"https://github.com/jy0529/vite-plugin-dynamic-publicpath/issues"},"homepage":"https://github.com/jy0529/vite-plugin-dynamic-publicpath#readme","devDependencies":{"@types/node":"^16.0.0","es-module-lexer":"^0.6.0","vite":"^2.4.0"},"licenseText":"MIT License\n\nCopyright (c) 2021 Jy\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"vite-plugin-dynamic-publicpath@1.0.0","dist":{"shasum":"a91fe42bdbd5b5aaa2d0e404883f094e8556bde2","size":3497,"noattachment":false,"key":"/vite-plugin-dynamic-publicpath/-/vite-plugin-dynamic-publicpath-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/vite-plugin-dynamic-publicpath/download/vite-plugin-dynamic-publicpath-1.0.0.tgz"},"_npmUser":{"name":"pure-jy","email":"purejy@163.com"},"directories":{},"maintainers":[{"name":"pure-jy","email":"purejy@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-dynamic-publicpath_1.0.0_1625502974242_0.13829528891699128"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-27T17:54:19.036Z","publish_time":1625502974387,"_cnpm_publish_time":1625502974387}},"readme":"# vite-plugin-dynamic-publicpath\n\n## Why\nUse dynamic import handler to change runtime public base path, like webpack's `__webpack_public_path__`.\n\n## Usage\n\n- run `yarn add vite-plugin-dynamic-publicpath --dev`\n- add the plugin into `vite.config.ts`\n``` ts\n// vite.config.ts\n\nimport { useDynamicPublicPath } from 'vite-plugin-dynamic-publicpath'\nexport default defineConfig({\n  plugins: [\n    useDynamicPublicPath(/** option */),\n  ]\n})\n```\ne.g. [basic demo](https://github.com/jy0529/vite-plugin-dynamic-publicpath/tree/main/examples/dynamic-publicpath-demo)\n\n\n```ts\n// main.ts\n\n// Your dynamic cdn\nconst dynamicCdn = oneOf(['cdn.xxx.com', 'cdn1.xxx.com']);\nwindow.__dynamicImportHandler__ = function(importer) {\n    return dynamicCdn + importer;\n}\nwindow.__dynamicImportPreload__ = function(preloads) {\n    return preloads.map(preload => dynamicCdn + preload);\n}\n\n```\n### For legacy browser\ne.g. [legacy browser demo](https://github.com/jy0529/vite-plugin-dynamic-publicpath/tree/main/examples/legacy-demo)\n```ts\n// vite.config.ts\n\nimport legacy from '@vitejs/plugin-legacy'\nimport { useDynamicPublicPath } from 'vite-plugin-dynamic-publicpath'\nexport default defineConfig({\n  plugins: [\n    /**\n     * @see https://github.com/vitejs/vite/tree/main/packages/plugin-legacy\n     * /\n    legacy({\n      targets: ['defaults', 'not ie <= 8'] \n    }),\n    /** Attention! The legacy plugin must before loaded than dynamic-publicpath plugin */\n    useDynamicPublicPath({\n      dynamicImportHandler: 'window.__dynamic_handler__',\n      dynamicImportPreload: 'window.__dynamic_preload__'\n    }),\n  ]\n})\n\n```\n\n## [Options](https://github.com/jy0529/vite-plugin-dynamic-publicpath/blob/main/index.d.ts)\n\n### `dynamicImportHandler`\n\nType: `string`<br>\nDefault: `window.__dynamicImportHandler__`\n\nRegister dynamic import handler\n\n### `dynamicImportPreload`\n\nType: `string`<br>\nDefault: `window.__dynamicImportPreload__`\n\nRegister dynamic import preload handler\n\n### `assetsBase`\n\nType: `string`<br>\nDefault: `assets`\n\nCustom the assets directory.\n","_attachments":{},"homepage":"https://github.com/jy0529/vite-plugin-dynamic-publicpath#readme","bugs":{"url":"https://github.com/jy0529/vite-plugin-dynamic-publicpath/issues"},"license":"MIT"}