今天我发现发布的工件不包括我的阴影库。我想把它们放在里面,所以我决定在 build.gradle 中编辑我的发布部分
publishing {
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/oraxen/Oraxen"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
shadow(MavenPublication) {
from components.java
artifact shadowJar
}
}
}
// entire file: https://github.com/oraxen/oraxen/blob/06ca465c8854c9e3df386a608845d86852e70560/build.gradle
Run Code Online (Sandbox Code Playgroud)
不幸的是我收到了这个错误:
Execution failed for task ':publishShadowPublicationToGitHubPackagesRepository'.
> Failed to publish publication 'shadow' to repository 'GitHubPackages'
> Invalid publication 'shadow': multiple artifacts with the identical extension and classifier ('jar', 'all').
* Try:
Run with --stacktrace option to get the stack …Run Code Online (Sandbox Code Playgroud) 我已经尝试将 Web Workers 与 React 一起使用几天了,但遇到了一些问题。
我从使用 webpack 4 的 create-react-app 开始。我可以使用本教程使用 Web Worker: https: //javascript.plainenglish.io/web-worker-in-react-9b2efafe309c,它以这种方式加载 WebWorker:
export default class WorkerBuilder extends Worker {
constructor(worker) {
const code = worker.toString();
const blob = new Blob([`(${code})()`]);
return new Worker(URL.createObjectURL(blob));
}
}
Run Code Online (Sandbox Code Playgroud)
不幸的是,我需要使用我的工作人员(d3-delaunay)中的一个库,当我尝试这样做时,webpack 给了我一个错误(我认为它改变了它的路径)。
我听说过worker-loader,并且了解到它已被弃用,因为Web Worker导入现在是在webpack 5中内置的。
我将我的应用程序更新到了 WebPack 5(如 create-react-app wiki 中所述),这并不容易,因为我的很多依赖项都损坏了。
但是当我尝试加载我的 WebWorker 时,如下所述: https: //webpack.js.org/guides/web-workers/ 这根本不起作用(没有错误)。
这是我的代码:
console.log("hello");
const worker = new Worker(new URL('./world.worker.js', import.meta.url));
worker.postMessage({
question:
'The Answer to the Ultimate Question of Life, The Universe, and …Run Code Online (Sandbox Code Playgroud) 我正在为我的网络应用程序使用 next.js。我使用 WebGL 渲染 2d 场景。我的 javascript 中有一个片段和一个顶点着色器硬编码为字符串:
var fragmentShaderSource = [
` #ifdef GL_ES`,
`precision highp float;`,
` #endif`,
``,
`uniform vec4 uGlobalColor;`,
``,
`void main() {`,
` gl_FragColor = uGlobalColor;`,
`}`,
].join("\n");
...
let shader = gl.createShader(type);
gl.shaderSource(shader, fragmentShaderSource);
gl.compileShader(shader);
Run Code Online (Sandbox Code Playgroud)
这很糟糕,我更愿意使用单独的fragment.glsl和vertex.glsl文件进行开发(即使编译版本最后得到一个硬编码的字符串)。我读过有关 webpack 的内容,但这是我第一次使用 next/webpack,我不确定要做什么(示例已有 6 年或更长的历史)。
我经常可以使用不太优雅的代码来制作函数的终端递归版本。我应该这样做,因为它可以减少费用,还是应该保留未优化的版本?
例如,这是一个“未优化”的函数,它对数组的元素求和:
@view
func get_convoy_strength{syscall_ptr : felt*, pedersen_ptr : HashBuiltin*, range_check_ptr}(
convoy_id : felt
) -> (strength : felt):
alloc_locals
let (convoyables_len : felt, convoyables : felt*) = get_convoyables(convoy_id)
return _get_convoyables_strength(convoyables_len, convoyables)
end
Run Code Online (Sandbox Code Playgroud)
这是尾调用优化:
func _get_convoyables_strength_tc{
syscall_ptr : felt*, pedersen_ptr : HashBuiltin*, range_check_ptr
}(convoyables_len : felt, convoyables : felt*, sum : felt) -> (strength : felt):
if convoyables_len == 0:
return (sum)
else:
let convoyable_id = [convoyables]
alloc_locals
let (convoyable_strength) = _get_strength(convoyable_id)
return _get_convoyables_strength_tc(
convoyables_len - 1, convoyables + 1, …Run Code Online (Sandbox Code Playgroud) javascript ×2
cairo-lang ×1
gradle ×1
groovy ×1
java ×1
next.js ×1
reactjs ×1
shader ×1
starknet ×1
web-worker ×1
webgl ×1
webpack ×1